summaryrefslogtreecommitdiff
path: root/update-kernel.in
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-10-24 18:38:33 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-10-24 19:33:54 +0300
commit2d0489a9dc00ece7e0cd79d6c161e9c65be0bff6 (patch)
tree9cb5f045a950c1f439cf3bfd372e1820b87a8f37 /update-kernel.in
parent12c69966a26745f38cda373997bf1f6b4cb92fde (diff)
downloadalpine-conf-2d0489a9dc00ece7e0cd79d6c161e9c65be0bff6.zip
update-kernel: silently skip non-existent packages
Diffstat (limited to 'update-kernel.in')
-rw-r--r--update-kernel.in22
1 files changed, 17 insertions, 5 deletions
diff --git a/update-kernel.in b/update-kernel.in
index ec507a7..cafa283 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -57,19 +57,31 @@ apk add -qU -t $VIRTUAL mkinitfs squashfs-tools
. /etc/mkinitfs/mkinitfs.conf
-ARCH=$(apk --print-arch)
FLAVOR=$(uname -r | cut -d - -f 3-)
TMPDIR=$(mktemp -dt $SCRIPT.XXXXXX)
ROOT=$TMPDIR/root
_apk() {
- apk add -q -p "$ROOT" --no-scripts --arch $ARCH --keys-dir /etc/apk/keys \
+ local cmd=$1
+ shift
+ apk $cmd -p "$ROOT" --keys-dir /etc/apk/keys \
--repositories-file /etc/apk/repositories $*
}
-_apk -U --initdb alpine-base linux-$FLAVOR linux-firmware
-_apk dahdi-linux dahdi-linux-$FLAVOR || :
-_apk xtables-addons-$FLAVOR || :
+add_pkgs() {
+ _apk add -q --no-scripts $*
+}
+
+extra_pkgs() {
+ local res=$(_apk search -x $1)
+ if [ "$res" ]; then
+ add_pkgs $*
+ fi
+}
+
+add_pkgs -U --initdb alpine-base linux-$FLAVOR linux-firmware
+extra_pkgs dahdi-linux-$FLAVOR dahdi-linux
+extra_pkgs xtables-addons-$FLAVOR
KVER=$(ls "$ROOT/lib/modules")