summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-03-21 20:38:40 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2018-03-21 20:38:40 +0100
commit1810f6f2f22b642268e334d1dd9af1581337c93c (patch)
treed3628e3c142ca21e2f363d6d86d637c904042271
parent6b320900b70ae1b288d35ca9182a70a933d7834d (diff)
Add upgrade option
-rwxr-xr-xbuild.sh3
-rwxr-xr-xscripts/build_rootfs.sh13
2 files changed, 12 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 0d4b24d..800e410 100755
--- a/build.sh
+++ b/build.sh
@@ -155,6 +155,9 @@ build_procd() {
build_tarball() {
export SDK="$(pwd)/${sdk}"
local opts="-m $metadata"
+ if test ${ver} != snapshot; then
+ opts="$opts --upgrade"
+ fi
fakeroot scripts/build_rootfs.sh $rootfs $opts -o $lxc_tar --arch=${arch} --subarch=${subarch} --packages="${packages}" --files="${files}"
}
diff --git a/scripts/build_rootfs.sh b/scripts/build_rootfs.sh
index 7f7c575..fe21df9 100755
--- a/scripts/build_rootfs.sh
+++ b/scripts/build_rootfs.sh
@@ -3,7 +3,7 @@
set -e
usage() {
- echo "Usage: $0 [-a|--arch <arch>] [-s|--subarch <subarch>] [-o|--output <dst file>] [-p|--packages <packages>] [-f|--files <files>] [-m|--metadata <metadata.yaml>] <src tar>"
+ echo "Usage: $0 [-a|--arch <arch>] [-s|--subarch <subarch>] [-o|--output <dst file>] [-p|--packages <packages>] [-f|--files <files>] [-m|--metadata <metadata.yaml>] [-u|--upgrade] <src tar>"
exit 1
}
@@ -14,8 +14,9 @@ dst_file=/dev/stdout
files=
metadata=
metadata_dir=
+upgrade=
-temp=$(getopt -o "a:o:p:s:f:m:" -l "arch:,output:,packages:,subarch:,files:,metadata:,help" -- "$@")
+temp=$(getopt -o "a:o:p:s:f:m:u:" -l "arch:,output:,packages:,subarch:,files:,metadata:,upgrade,help" -- "$@")
eval set -- "$temp"
while true; do
case "$1" in
@@ -33,6 +34,8 @@ while true; do
metadata=`basename $2`
metadata_dir=`dirname $2`
shift 2;;
+ -u|--upgrade)
+ upgrade=1; shift 1;;
--help)
usage;;
--)
@@ -122,7 +125,7 @@ add_packages() {
update_packages() {
$OPKG update
- local upgradable="$($OPKG list-upgradable|cut -d ' ' -f 1)"
+ local upgradable="$($OPKG list-upgradable|grep -e '^.* - .* - .*'|cut -d ' ' -f 1)"
for pkg in $upgradable; do
echo Upgrading $pkg
$OPKG upgrade $pkg
@@ -144,7 +147,9 @@ if test -n "$metadata"; then
fi
add_files templates/ $dir/templates/
add_packages bin/packages/${arch}/${subarch}
-update_packages
+if test -n "$upgrade"; then
+ update_packages
+fi
install_packages "$packages"
add_files $files_dir $instroot
if test -n "$files"; then