summaryrefslogtreecommitdiffstats
path: root/buildlab.in
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-01-24 21:06:04 -0600
committerWilliam Pitcock <nenolod@dereferenced.org>2011-01-24 21:06:04 -0600
commit934c82305274eec50f04b3a5fccb149753250733 (patch)
treea21a0158fa063ff4a8709ab1a0c2de4d2c30d41a /buildlab.in
parentdf4893dec14ba22e2b9c43bb2b84b5dc96f55ce9 (diff)
downloadabuild-934c82305274eec50f04b3a5fccb149753250733.tar.bz2
abuild-934c82305274eec50f04b3a5fccb149753250733.tar.xz
buildlab: implement updating of buildroots.
Diffstat (limited to 'buildlab.in')
-rwxr-xr-xbuildlab.in23
1 files changed, 21 insertions, 2 deletions
diff --git a/buildlab.in b/buildlab.in
index b7f8722..43ffb08 100755
--- a/buildlab.in
+++ b/buildlab.in
@@ -10,6 +10,10 @@ SUDO=${SUDO:-"sudo"}
FAKEROOT=${FAKEROOT:-"fakeroot"}
APK=${APK:-apk}
+# read config
+ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
+[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
+
default_colors() {
NORMAL="\033[1;0m"
STRONG="\033[1;1m"
@@ -72,6 +76,13 @@ do_chroot_action() {
umount "$path"/sys
}
+update_chroot() {
+ local path="$1"
+
+ apk --root $path --repositories "$path"/etc/apk/repositories update
+ apk --root $path --repositories "$path"/etc/apk/repositories upgrade -a
+}
+
prepare_chroot() {
local path="$1"
local version="$2"
@@ -189,11 +200,12 @@ usage() {
echo " "
echo "sudo ./buildlab -C -p /home/nenolod/buildroot -m dl-3.alpinelinux.org -v edge -a x86_64"
echo "sudo ./buildlab -b /home/nenolod/aports/main/gnome-panel/APKBUILD -p /home/nenolod/buildroot"
+ echo "sudo ./buildlab -u -p /home/nenolod/buildroot"
}
unset force
unset recursive
-while getopts "chqCp:v:m:a:b:" opt; do
+while getopts "chqCp:v:m:a:b:u" opt; do
case $opt in
'c') default_colors
color_opt="-c";;
@@ -203,8 +215,9 @@ while getopts "chqCp:v:m:a:b:" opt; do
'p') buildpath="$OPTARG";;
'm') buildmirror="$OPTARG";;
'v') buildver="$OPTARG";;
- 'a') buildarch="$OPTARG";;
+ 'a') buildarch="$OPTARG";;
'b') buildpkg="$OPTARG";;
+ 'u') update="-u";;
esac
done
shift $(( $OPTIND - 1 ))
@@ -220,3 +233,9 @@ if [ ! -z "$buildpkg" ]; then
build_package $buildpath $buildpkg
exit 0
fi
+
+if [ ! -z "$update" ]; then
+ msg "Updating chroot at $buildpath..."
+ update_chroot $buildpath
+ exit 0
+fi