##// END OF EJS Templates
- cleanup of exports...
Unknown -
r503:1f9af7822e7c
parent child
Show More
@@ -1,77 +1,105
1 1 # This file contains utility functions used by rpi23-gen-image.sh
2 2
3 3 cleanup (){
4 4 set +x
5 5 set +e
6
7 # Remove exports from nexmon
8 unset KERNEL
9 unset ARCH
10 unset SUBARCH
11 unset CCPLUGIN
12 unset ZLIBFLATE
13 unset Q
14 unset NEXMON_SETUP_ENV
15 unset HOSTUNAME
16 unset PLATFORMUNAME
6 17
7 18 # Identify and kill all processes still using files
8 19 echo "killing processes using mount point ..."
9 20 fuser -k "${R}"
10 21 sleep 3
11 22 fuser -9 -k -v "${R}"
12 23
13 24 # Clean up temporary .password file
14 25 if [ -r ".password" ] ; then
15 26 shred -zu .password
16 27 fi
17 28
18 29 # Clean up all temporary mount points
19 30 echo "removing temporary mount points ..."
20 31 umount -l "${R}/proc" 2> /dev/null
21 32 umount -l "${R}/sys" 2> /dev/null
22 33 umount -l "${R}/dev/pts" 2> /dev/null
23 34 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
24 35 umount "$BUILDDIR/mount" 2> /dev/null
25 36 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
26 37 losetup -d "$ROOT_LOOP" 2> /dev/null
27 38 losetup -d "$FRMW_LOOP" 2> /dev/null
28 39 trap - 0 1 2 3 6
29 40 }
30 41
31 42 chroot_exec() {
32 43 # Exec command in chroot
33 44 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot "${R}" "$@"
34 45 }
35 46
36 47 as_nobody() {
37 48 # Exec command as user nobody
38 49 sudo -E -u nobody LANG=C LC_ALL=C "$@"
39 50 }
40 51
41 52 install_readonly() {
42 53 # Install file with user read-only permissions
43 54 install -o root -g root -m 644 "$@"
44 55 }
45 56
46 57 install_exec() {
47 58 # Install file with root exec permissions
48 59 install -o root -g root -m 744 "$@"
49 60 }
50 61
51 62 use_template () {
52 63 # Test if configuration template file exists
53 64 if [ ! -r "./templates/${CONFIG_TEMPLATE}" ] ; then
54 65 echo "error: configuration template ${CONFIG_TEMPLATE} not found"
55 66 exit 1
56 67 fi
57 68
58 69 # Load template configuration parameters
59 70 . "./templates/${CONFIG_TEMPLATE}"
60 71 }
61 72
62 73 chroot_install_cc() {
63 74 # Install c/c++ build environment inside the chroot
64 75 if [ -z "${COMPILER_PACKAGES}" ] ; then
65 76 COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
66 77 # Install COMPILER_PACKAGES in chroot
67 78 chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install "${COMPILER_PACKAGES}"
68 79 fi
69 80 }
70 81
71 82 chroot_remove_cc() {
72 83 # Remove c/c++ build environment from the chroot
73 84 if [ -n "${COMPILER_PACKAGES}" ] ; then
74 85 chroot_exec apt-get -qq -y --auto-remove purge "${COMPILER_PACKAGES}"
75 86 COMPILER_PACKAGES=""
76 87 fi
77 88 }
89 # GPL v2.0 - #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
90 set_kernel_config() {
91 # flag as $1, value to set as $2, config must exist at "./.config"
92 TGT="CONFIG_${1#CONFIG_}"
93 REP="${2}"
94 if grep -q "^${TGT}[^_]" .config; then
95 sed -i "s/^\(${TGT}=.*\|# ${TGT} is not set\)/${TGT}=${REP}/" .config
96 else
97 echo "${TGT}"="${2}" >> .config
98 fi
99 }
100 # unset kernel config parameter
101 unset_kernel_config() {
102 # unsets flag with the value of $1, config must exist at "./.config"
103 TGT="CONFIG_${1#CONFIG_}"
104 sed -i "s/^${TGT}=.*/# ${TGT} is not set/" .config
105 } No newline at end of file
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant