Commit 934c8230 authored by Ariadne Conill's avatar Ariadne Conill

buildlab: implement updating of buildroots.

parent df4893de
......@@ -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
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