aboutsummaryrefslogblamecommitdiffstats
path: root/main/alpine-conf/0001-update-kernel-Make-path-for-tmpdir-changeable-via-cl.patch
blob: f2b33e22058d9927eba169753982f73bf78fb1db (plain) (tree)































































                                                                                                                                                                                               
From 661f3b90f29f96a733aaff62ff0ca899ed34234d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= <dev@fedux.org>
Date: Sun, 30 May 2021 15:16:17 +0200
Subject: [PATCH] update-kernel: Make path for tmpdir changeable via cli flag

On a Raspberry Pi 3B+ the memory is limited. Updating a kernel might be not possible due to "out of space" situations. This MR adds a flag to mitigate the problem for users facing this issue.
---
 update-kernel.in | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/update-kernel.in b/update-kernel.in
index dce5006..51fed76 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -31,6 +31,7 @@ REPOSITORIES_FILE=/etc/apk/repositories
 KEYS_DIR=/etc/apk/keys
 SIGNALS="HUP INT TERM"
 TMPDIR=
+TMPDIR_PATH="/tmp"
 features=
 modloopfw=
 
@@ -55,6 +56,7 @@ usage() {
 		         -F|--feature <feature>    Enable initfs feature
 		         -p|--package <package>    Additional module or firmware package
 		         -s|--modloopsign          Sign modloop with abuild key
+		         -t|--tmpdir <directory>   Choose different (non RAM) temporary directory for build files etc. 
 		         -v|--verbose              Verbose output
 		         -k|--apk-pubkey <key>     Include given key in initramfs
 		         -K|--hostkeys             Include host keys in initramfs
@@ -68,8 +70,8 @@ usage() {
 }
 
 QUIET_OPT="--quiet"
-OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,modloopfw:,help,package:,modloopsign,verbose,apk-pubkey:,hostkeys,compression:,media,repositories-file:,keys-dir: \
-	-n $SCRIPT -o a:b:f:F:hp:svk:KC:Md: -- "$@") || usage 1
+OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,modloopfw:,help,package:,modloopsign,tmpdir:,verbose,apk-pubkey:,hostkeys,compression:,media,repositories-file:,keys-dir: \
+	-n $SCRIPT -o a:b:f:F:hp:st:vk:KC:Md: -- "$@") || usage 1
 
 eval set -- "$OPTS"
 while :; do
@@ -105,6 +107,10 @@ while :; do
 	-s|--modloopsign)
 		MODLOOPSIGN=1
 		;;
+	-t|--tmpdir)
+		shift
+		TMPDIR_PATH="$1"
+		;;
 	-v|--verbose)
 		QUIET_OPT=
 		;;
@@ -218,7 +224,7 @@ fi
 
 [ "$ARCH" ] || ARCH=$(apk --print-arch)
 
-TMPDIR=$(mktemp -d /tmp/$SCRIPT.XXXXXX)
+TMPDIR=$(mktemp -d "$TMPDIR_PATH/$SCRIPT.XXXXXX")
 ROOT=$TMPDIR/root
 BOOT=$ROOT/boot
 
-- 
2.31.1