aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-update-kernel-Make-path-for-tmpdir-changeable-via-cl.patch
blob: f2b33e22058d9927eba169753982f73bf78fb1db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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