diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-23 14:22:13 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-23 14:22:13 +0200 |
commit | bad905a4eaa49e8eca307ef28acacb2ee55fc34a (patch) | |
tree | 5b5b606b080180624130a7fa083e0fbd2af5d46a | |
parent | c6d3753d970a459168b45006cfdcbb7103f8ecd2 (diff) | |
download | alpine-conf-bad905a4eaa49e8eca307ef28acacb2ee55fc34a.zip |
setup-lbu: improve $ROOT support
-rw-r--r-- | setup-lbu.in | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/setup-lbu.in b/setup-lbu.in index 1a27657..d5c10ff 100644 --- a/setup-lbu.in +++ b/setup-lbu.in @@ -57,16 +57,25 @@ set_media() { mnt="$media" media=${mnt#/media/} fi - if ! [ -d "$mnt" ]; then + if [ "$ROOT" = "/" ] && ! [ -d "$mnt" ]; then echo "$mnt: not a directory" >&2 exit 1 fi # set LBU_MEDIA in /etc/lbu/lbu.conf - sed -i -e "/^\#\?[[:space:]]*LBU_MEDIA=.*/s/.*/LBU_MEDIA=$media/" \ - /etc/lbu/lbu.conf - if ! egrep -q '^LBU_MEDIA=' /etc/lbu/lbu.conf; then - echo "LBU_MEDIA=$media" >> /etc/lbu/lbu.conf + if [ -f "${ROOT}"etc/lbu/lbu.conf ]; then + sed -e "/^\#\?[[:space:]]*LBU_MEDIA=.*/s/.*/LBU_MEDIA=$media/" \ + -i "${ROOT}"etc/lbu/lbu.conf + if ! egrep -q '^LBU_MEDIA=' "${ROOT}"etc/lbu/lbu.conf; then + echo "LBU_MEDIA=$media" >> "${ROOT}"etc/lbu/lbu.conf + fi + else + mkdir -p "${ROOT}"etc/lbu + echo "LBU_MEDIA=$media" >> "${ROOT}"etc/lbu/lbu.conf + fi + + if [ -n "$ROOT" ] && [ "$ROOT" != "/" ]; then + return fi # append to fstab if its missing @@ -74,7 +83,7 @@ set_media() { get_mnt_line "$mnt" /proc/mounts >> /etc/fstab fi - # hack in case we have alpine_dev moutned on /media/usbdisk but + # hack in case we have alpine_dev mounted on /media/usbdisk but # lbu is stored on /media/usb # Otherwise we get issues when we do lbu commit. if [ "$media" = "usb" ] && is_mounted /media/usbdisk; then |