Commit bad905a4 authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-lbu: improve $ROOT support

parent c6d3753d
...@@ -57,16 +57,25 @@ set_media() { ...@@ -57,16 +57,25 @@ set_media() {
mnt="$media" mnt="$media"
media=${mnt#/media/} media=${mnt#/media/}
fi fi
if ! [ -d "$mnt" ]; then if [ "$ROOT" = "/" ] && ! [ -d "$mnt" ]; then
echo "$mnt: not a directory" >&2 echo "$mnt: not a directory" >&2
exit 1 exit 1
fi fi
# set LBU_MEDIA in /etc/lbu/lbu.conf # set LBU_MEDIA in /etc/lbu/lbu.conf
sed -i -e "/^\#\?[[:space:]]*LBU_MEDIA=.*/s/.*/LBU_MEDIA=$media/" \ if [ -f "${ROOT}"etc/lbu/lbu.conf ]; then
/etc/lbu/lbu.conf sed -e "/^\#\?[[:space:]]*LBU_MEDIA=.*/s/.*/LBU_MEDIA=$media/" \
if ! egrep -q '^LBU_MEDIA=' /etc/lbu/lbu.conf; then -i "${ROOT}"etc/lbu/lbu.conf
echo "LBU_MEDIA=$media" >> /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 fi
# append to fstab if its missing # append to fstab if its missing
...@@ -74,7 +83,7 @@ set_media() { ...@@ -74,7 +83,7 @@ set_media() {
get_mnt_line "$mnt" /proc/mounts >> /etc/fstab get_mnt_line "$mnt" /proc/mounts >> /etc/fstab
fi 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 # lbu is stored on /media/usb
# Otherwise we get issues when we do lbu commit. # Otherwise we get issues when we do lbu commit.
if [ "$media" = "usb" ] && is_mounted /media/usbdisk; then if [ "$media" = "usb" ] && is_mounted /media/usbdisk; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment