# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Tue Aug 26 20:59:31 CEST 2008 [mika]
################################################################################
set -e # exit on any error
# use aptitude only if it's available
if [ -x /usr/bin/aptitude ] ; then
- APTINSTALL='aptitude -y install '
+ APTINSTALL='aptitude -y --without-recommends install '
APTUPDATE='aptitude update'
else
APTINSTALL='apt-get --force-yes -y install'
exit 1
else
$APTUPDATE
- DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $(cat /etc/debootstrap/packages) $GRMLPACKAGES
+ DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $(grep -v '^#' /etc/debootstrap/packages) $GRMLPACKAGES
fi
fi
}
# }}}
# set password of user root {{{
-passwords() {
+passwords()
+{
echo "Activating shadow passwords."
shadowconfig on
if [ -n "$ROOTPASSWORD" ] ; then
- echo root:"$ROOTPASSWD" | chpasswd -m
- export ROOTPASSWD=''
+ echo root:"$ROOTPASSWORD" | chpasswd -m
+ export ROOTPASSWORD=''
else
+ a='1'
+ b='2'
echo "Setting password for user root:"
- echo -n "Enter new UNIX password for user root: "
- read -s a
- echo root:"$a" | chpasswd -m
- unset a
- echo
+ while [ "$a" != "$b" ] ; do
+ echo -n "Enter new UNIX password for user root: "
+ read -s a
+ echo
+ echo -n "Retype new UNIX password for user root: "
+ read -s b
+ echo
+ if [ "$a" != "$b" ] ; then
+ echo "Sorry, passwords do not match. Retry."
+ a='1'
+ b='2'
+ else
+ echo root:"$a" | chpasswd -m
+ unset a
+ unset b
+ fi
+ done
fi
}
# }}}
# helper function for fstab() {{{
createfstab(){
echo "Setting up /etc/fstab"
-cat > /etc/fstab << EOF
-$TARGET / auto defaults,errors=remount-ro 0 1
+if [ -n "$TARGET_UUID" ] ; then
+ echo "/dev/disk/by-uuid/${TARGET_UUID} / auto defaults,errors=remount-ro 0 1" > /etc/fstab
+else
+ echo "${TARGET} / auto defaults,errors=remount-ro 0 1" > /etc/fstab
+fi
+
+cat >> /etc/fstab << EOF
proc /proc proc defaults 0 0
/sys /sys sysfs noauto,rw,nosuid,nodev,noexec 0 0
/dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0
$UPDATEGRUB -y
if [ -f /boot/grub/menu.lst ] ; then
sed -i "s/^# groot=.*/# groot=(${GROOT})/g" /boot/grub/menu.lst
- sed -i "s|^# kopt=root=.*|# kopt=root=${TARGET} ro ${BOOT_APPEND}|g" /boot/grub/menu.lst
+ if [ -n "$TARGET_UUID" ] ; then
+ sed -i "s|^# kopt=root=.*|# kopt=root=UUID=${TARGET_UUID} ro ${BOOT_APPEND}|g" /boot/grub/menu.lst
+ else
+ sed -i "s|^# kopt=root=.*|# kopt=root=${TARGET} ro ${BOOT_APPEND}|g" /boot/grub/menu.lst
+ fi
# not sure why savedefault does not work for me; any ideas?
sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst
$UPDATEGRUB -y