aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fripost-partman-udeb/base.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/fripost-partman-udeb/base.sh b/src/fripost-partman-udeb/base.sh
index 3266bc6..d44d983 100644
--- a/src/fripost-partman-udeb/base.sh
+++ b/src/fripost-partman-udeb/base.sh
@@ -206,7 +206,7 @@ fripost_encrypt() {
db_go
db_get fripost/encryption-password
- if [ -n "$RET" ]; then
+ if [ "$RET" ]; then
log "The password can be found from debconf (hey, that's insecure!)"
# Since we're using the builtin, the password shouldn't be
# visible in ps(1).
@@ -381,7 +381,7 @@ fripost_mkfs() {
# XXX: The parsing has been tested with mkfs.ext{2,3,4} only.
case "$line" in
*:*/*)
- [ -z "$total" ] || db_progress STOP
+ [ "$total" ] && db_progress STOP
stage="${line%: *}"
step="${line##*: }"
@@ -395,10 +395,10 @@ fripost_mkfs() {
db_progress INFO fripost/mkfs_progress_info
;;
*/$total)
- [ -z "$total" ] || db_progress SET ${line%/*}
+ [ "$total" ] && db_progress SET ${line%/*}
;;
done)
- [ -z "$total" ] || db_progress SET $total
+ [ "$total" ] && db_progress SET $total
;;
esac
done 7< "$fifo"
@@ -406,7 +406,7 @@ fripost_mkfs() {
rm -f "$fifo"
trap '' EXIT
- [ -z "$total" ] || db_progress STOP
+ [ "$total" ] && db_progress STOP
db_unregister fripost/mkfs_progress_title
db_unregister fripost/mkfs_progress_info
}
@@ -463,7 +463,7 @@ fripost_fstab_addentry() {
# Always use UUIDs
local uuid=$(/bin/block-attr --uuid "$device")
- if [ -z "$uuid" ]; then
+ if [ ! "$uuid" ]; then
log "Warning: Block device $device has no UUID!"
printf "$entry" "$device" $mp $type $options $dump $pass >> $fstab
else
@@ -510,7 +510,7 @@ fripost_mount_partitions() {
# 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])' )
- [ -n "$cdrom" ] || fatal "Error: Is /cdrom a mountpoint?"
+ [ "$cdrom" ] || fatal "Error: Is /cdrom a mountpoint?"
fripost_fstab_addentry "$cdrom" /media/cdrom0 udf,iso9660 user,noauto 0 0
mkdir -p /target/media/cdrom0
ln -s cdrom0 /target/media/cdrom
@@ -522,5 +522,8 @@ fripost_mount_partitions() {
}
getIPv4() {
- /bin/ip addr show "${1:-eth0}" | sed -nr 's/^\s+inet\s([0-9.]{4,32}).*/\1/p'
+ local if=$( /bin/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 \
+ | sed -nr '/^\s+inet\s([[:xdigit:].:]{3,39}).*/ {s//\1/p;q}'
}