From e13d4b56eabe125b9a4a73a25f04060518e82048 Mon Sep 17 00:00:00 2001 From: Jeff Bilyk Date: Wed, 8 Jun 2011 22:31:20 +0000 Subject: setup-apklbu: handle ro media for apk and lbu --- setup-apklbu.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'setup-apklbu.in') diff --git a/setup-apklbu.in b/setup-apklbu.in index 91aac54..7e548a2 100755 --- a/setup-apklbu.in +++ b/setup-apklbu.in @@ -18,6 +18,23 @@ fi mountpoint="usb" echo "Please enter mountpoint directory under /media for lbu ($mountpoint):" default_read mountpoint "$mountpoint" + +mountstatus="`mount | grep /media/${mountpoint}`" + +if [ -z $mountstatus ]; then + echo "$mountpoint is not mounted" && exit 1 +fi + +readwritestatus="`echo $mountstatus | awk -F '(' '{print $2}' | awk -F ',' '{print $1}'`" + +if [ "$readwritestatus" == "ro" ]; then + rewrite=1 +fi + +if [ "$rewrite" == 1 ]; then + mount -o remount,rw /media/${mountpoint} || die "Failed to remount media rw" +} + mkdir -p /media/${mountpoint}/cache || die "Failed to create /media/${mountpoint}/cache" ln -s /media/${mountpoint}/cache /etc/apk/cache || die "Failed to create apk cache softlink" cat > /etc/lbu/lbu.conf <