summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Bilyk <jbilyk@gmail.com>2011-07-16 21:47:57 -0400
committerJeff Bilyk <jbilyk@gmail.com>2011-07-16 21:47:57 -0400
commitc67ff2550962e8857d9a7c3859fc5003324e418a (patch)
tree7983516df7b15a3bec29513f6f88387747437d5e
parent0bb9e13996ddca7785fbc108f768570ef8ceea8a (diff)
downloadalpine-conf-c67ff2550962e8857d9a7c3859fc5003324e418a.zip
setup-bootable: rewrite apk cache section to...work
-rw-r--r--setup-bootable.in26
1 files changed, 14 insertions, 12 deletions
diff --git a/setup-bootable.in b/setup-bootable.in
index 2fa8428..8026226 100644
--- a/setup-bootable.in
+++ b/setup-bootable.in
@@ -115,6 +115,10 @@ elif [ -b "$dest" ]; then
mount "$dest" "$destdir" || die "Failed to mount $dest on $destdir"
umounts="$umounts $destdir"
fi
+
+# Check for RO mounting
+if [ "`grep \"$destdir\" /proc/mount | grep '(ro,'`"
+
[ -n "$verbose" ] && echo "Using $dest as target (mounted on $destdir)"
@@ -213,21 +217,19 @@ done
# Update the cache folder on destdir if present
if [ -e "$destdir"/*.apkovl.tar.gz ] && [ -e "$destdir"/cache ]; then
- apkovlfile="`ls ${destdir}/*.apkovl.tar.gz | head -n 1`"
-
- #Get first file apk/world
- worldfile="`tar tzf $apkovlfile | grep apk/world | head -n 1`"
- apkstofetch="`cat $worldfile`"
mkdir "$destdir"/tmp.cache
- # If repository update suceeds, fetch copy of all apks in world
- apk update && apk fetch -R $apkstofetch -o "$destdir"/tmp.cache
+ mv /etc/apk/cache /etc/apk/cache.temp
+ ln -s "destdir"/tmp.cache/ /etc/apk/cache
+
+ mkdir "destdir"/cache.old
+ mv "$destdir"/cache/* "$destdir"/cache.old/
+
+ apk update
+ apk cache sync
- # Copy apks to cache dir if verify passes, then re-index
- apk verify "$destdir"/tmp.cache/*.apk && mv "$destdir"/tmp.cache/*.apk "$destdir"/cache/ && apk index -o "$destdir"/cache/APKINDEX.tar.gz "$destdir"/cache/*.apk
- if [ "`ls ${destdir}/tmp.cache`" == "" ]; then
- rm -rf "$destdir"/tmp.cache
- fi
+ mv "$destdir"/tmp.cache/* "$destdir"/cache/ && rm -rf "$destdir"/cache.old
+ rm -rf "$destdir"/tmp.cache
fi
# cleanup