From 34b5dc134ed6ba8dc6f922915c894fb0a176f0b5 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 3 Jan 2014 01:41:05 +0100 Subject: bugfix --- include/partition.sh | 7 ++++++- preseed.cfg | 2 +- src/fripost-partman-udeb/base.sh | 14 ++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/partition.sh b/include/partition.sh index 7e9fbed..fda2734 100755 --- a/include/partition.sh +++ b/include/partition.sh @@ -19,9 +19,14 @@ set -ue . /lib/fripost-partman/base.sh +device=/dev/sda + +# Umount existing mountpoints +for mp in $(sed -nr "s#^$device\S*\s+(\S+).*#\1#p" /proc/mounts); do + umount "$mp" +done # Wipe the disk -device=/dev/sda fripost_wipe $device db_get fripost/encrypt diff --git a/preseed.cfg b/preseed.cfg index 01b4cec..9a9ce28 100644 --- a/preseed.cfg +++ b/preseed.cfg @@ -46,7 +46,7 @@ d-i passwd/root-login boolean false d-i passwd/shadow boolean true d-i passwd/user-fullname string Guilhem Moulin d-i passwd/username string guilhem -# TODO: should be generated by preseed.sh: echo ... | mkpasswd -s -H SHA-512 +# TODO: should be generated by preseed.sh: echo ... | mkpasswd -s -m SHA-512 d-i passwd/user-password-crypted password $6$QjLeZdW1O$9VymVDc5q6NctEylAqObvmP4S7FXk1ckCPaHua0JaiFSaTeTKoWxaP7bQoUWvzCPDY23Xqthg87QDBbaCY9BP0 d-i passwd/user-default-groups string ssh diff --git a/src/fripost-partman-udeb/base.sh b/src/fripost-partman-udeb/base.sh index 6ca8ddc..e6a3bf9 100644 --- a/src/fripost-partman-udeb/base.sh +++ b/src/fripost-partman-udeb/base.sh @@ -484,7 +484,7 @@ fripost_fstab_addentry() { if ! [ -h /dev/disk/by-uuid/"$uuid" ]; then device=$(/bin/mapdevfs "$device") log "Adding a symlink UUID $uuid -> $device" - ln -s ../../"${device#/dev/}" /dev/disk/by-uuid/"$uuid" + ln -fs ../../"${device#/dev/}" /dev/disk/by-uuid/"$uuid" fi fi } @@ -517,9 +517,8 @@ fripost_mount_partitions() { done # Post-installation scripts may use the install CD as a local mirror - # for APT packages. TODO: What if it was a USB stick? A netboot? - cdrom=$( sed -rn 's#^(\S+) /cdrom.*#\1#p' /proc/mounts \ - | grep -m1 -Ev '^/dev/(loop|sd[a-z])' ) + # for APT packages. + cdrom=$( sed -rn 's#^(\S+) /cdrom\s.*#\1#p' /proc/mounts | head -1 ) [ "$cdrom" ] || fatal "Error: Is /cdrom a mountpoint?" fripost_fstab_addentry "$cdrom" /media/cdrom0 udf,iso9660 user,noauto 0 0 mkdir -p /target/media/cdrom0 @@ -532,8 +531,11 @@ fripost_mount_partitions() { } getIPv4() { - local if=$( /bin/ip -4 route show to default scope global \ + local ip=/sbin/ip + [ -x $ip ] || ip=/bin/ip + [ -x $ip ] || fatal "Error: couldn't find ip(8)" + local if=$( $ip -4 route show to default scope global \ | sed -nr '/^default via \S+ dev (\S+).*/ {s//\1/p;q}' ) - /bin/ip -4 address show dev "$if" scope global \ + $ip -4 address show dev "$if" scope global \ | sed -nr '/^\s+inet\s([[:xdigit:].:]{3,39}).*/ {s//\1/p;q}' } -- cgit v1.2.3