aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Bilyk <jbilyk@gmail.com>2011-07-16 15:14:57 -0400
committerJeff Bilyk <jbilyk@gmail.com>2011-07-16 15:14:57 -0400
commit0b3ae89a2abdaccea8eac0a089c1e1fd589c5c3e (patch)
treee474b4889bd52fa676be4df4dceb87e8c7c82a23
parent37033af8f9df2703a1e1cf922968752309690796 (diff)
downloadalpine-conf-0b3ae89a2abdaccea8eac0a089c1e1fd589c5c3e.tar.bz2
alpine-conf-0b3ae89a2abdaccea8eac0a089c1e1fd589c5c3e.tar.xz
setup-bootable: enhance to update apk cache on USB/CF installs if it's been setup
-rw-r--r--setup-bootable.in22
1 files changed, 22 insertions, 0 deletions
diff --git a/setup-bootable.in b/setup-bootable.in
index 7ecedfb..2fa8428 100644
--- a/setup-bootable.in
+++ b/setup-bootable.in
@@ -59,6 +59,7 @@ Options:
-f Force overwrite existing files. Will overwrite syslinux.cfg if upgrade.
-h Show this help.
-u Upgrade mode. Keep existing syslinux.cfg and don't run syslinux.
+ If apk cache is detected, attempts to upgrade the apk cache
-s Force run syslinux, even if upgrade mode.
-v Verbose mode. Display whats going on.
@@ -176,6 +177,8 @@ elif [ -n "$srcurl" ]; then
|| die "Failed to download or extract $srcurl"
fi
+
+
# make sure files are really there before we replace existing
[ -n "$verbose" ] && echo "Flushing cache..."
sync
@@ -208,6 +211,25 @@ for i in $tomove; do
mv "$destdir"/.new/$i "$destdir"/ || die "Failed to move $destdir/.new/ to $destdir"
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
+
+ # 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
+fi
+
# cleanup
[ -z "$keep_old" ] && rm -rf "$destdir"/.old "$destdir"/.new
sync