Commit 63a3fbcf authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

update-kernel: option for overriding architecture

parent 33da382f
...@@ -15,6 +15,7 @@ VIRTUAL=.tmp-$SCRIPT ...@@ -15,6 +15,7 @@ VIRTUAL=.tmp-$SCRIPT
SUPERUSER= SUPERUSER=
[ $(id -u) -eq 0 ] && SUPERUSER=Y [ $(id -u) -eq 0 ] && SUPERUSER=Y
ARCH=
BUILDDIR= BUILDDIR=
FLAVOR= FLAVOR=
MNTDIR= MNTDIR=
...@@ -30,13 +31,15 @@ error() { ...@@ -30,13 +31,15 @@ error() {
usage() { usage() {
[ "$2" ] && error "$2" [ "$2" ] && error "$2"
local opts="[-F <feature>]... [-p <package>]..." local opts="[-F <feature>]... [-p <package>]..."
local dest_args="[-a <arch>] <dest_dir>"
cat >&2 <<EOF cat >&2 <<EOF
Syntax: $SCRIPT $opts [<dest_dir>] Syntax: $SCRIPT $opts [$dest_args]
$SCRIPT -f <flavor> $opts <dest_dir> $SCRIPT -f <flavor> $opts $dest_args
$SCRIPT -b <build_dir> $opts [<dest_dir>] $SCRIPT -b <build_dir> $opts [$dest_args]
Options: -b|--build <build_dir> Install custom-built kernel Options: -a|--arch <arch> Install kernel for specified architecture
-b|--build <build_dir> Install custom-built kernel
-f|--flavor <flavor> Install kernel of specified flavor -f|--flavor <flavor> Install kernel of specified flavor
-F|--feature <feature> Enable initfs feature -F|--feature <feature> Enable initfs feature
-p|--package <package> Additional module or firmware package -p|--package <package> Additional module or firmware package
...@@ -47,30 +50,34 @@ EOF ...@@ -47,30 +50,34 @@ EOF
} }
QUIET_OPT="--quiet" QUIET_OPT="--quiet"
OPTS=$(getopt -l build-dir:,flavor:,feature:,help,package:,verbose -n $SCRIPT \ OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,verbose \
-o b:f:F:hp:v -- "$@") || usage 1 -n $SCRIPT -o a:b:f:F:hp:v -- "$@") || usage 1
eval set -- "$OPTS" eval set -- "$OPTS"
while :; do while :; do
case "$1" in case "$1" in
-a|--arch)
shift
ARCH=$1
;;
-b|--build-dir) -b|--build-dir)
BUILDDIR=$2
shift shift
BUILDDIR=$1
;; ;;
-f|--flavor) -f|--flavor)
FLAVOR=$2
shift shift
FLAVOR=$1
;; ;;
-F|--feature) -F|--feature)
features="$features $2"
shift shift
features="$features $1"
;; ;;
-h|--help) -h|--help)
echo "$SCRIPT @VERSION@" >&2 echo "$SCRIPT @VERSION@" >&2
usage 0 usage 0
;; ;;
-p|--package) -p|--package)
PACKAGES="$PACKAGES $2"
shift shift
PACKAGES="$PACKAGES $1"
;; ;;
-v|--verbose) -v|--verbose)
QUIET_OPT= QUIET_OPT=
...@@ -89,6 +96,9 @@ DESTDIR=$2 ...@@ -89,6 +96,9 @@ DESTDIR=$2
usage 1 "Cannot specify both build directory and flavor" usage 1 "Cannot specify both build directory and flavor"
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
[ "$ARCH" ] && \
usage 1 "Cannot specify architecture when updating the current kernel"
[ "$FLAVOR" ] && \ [ "$FLAVOR" ] && \
usage 1 "Cannot specify flavor when updating the current kernel" usage 1 "Cannot specify flavor when updating the current kernel"
...@@ -166,7 +176,8 @@ _apk() { ...@@ -166,7 +176,8 @@ _apk() {
wrapper="fakeroot $opt -s $fake_env --" wrapper="fakeroot $opt -s $fake_env --"
fi fi
$wrapper apk $cmd $QUIET_OPT -p $ROOT --keys-dir /etc/apk/keys \ $wrapper apk $cmd $QUIET_OPT -p $ROOT ${ARCH:+--arch "$ARCH"} \
--keys-dir /etc/apk/keys \
--repositories-file /etc/apk/repositories $* --repositories-file /etc/apk/repositories $*
} }
......
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