functions.sh
38 lines
| 941 B
| application/x-sh
|
BashLexer
Jan Wagner
|
r67 | # This file contains utility functions used by rpi2-gen-image.sh | ||
Filip Pytloun
|
r56 | cleanup (){ | ||
set +x | ||||
set +e | ||||
Jan Wagner
|
r67 | |||
# Identify and kill all processes still using files | ||||
Filip Pytloun
|
r59 | echo "killing processes using mount point ..." | ||
fuser -k $R | ||||
sleep 3 | ||||
fuser -9 -k -v $R | ||||
Jan Wagner
|
r67 | |||
# Clean up all temporary mount points | ||||
Filip Pytloun
|
r56 | echo "removing temporary mount points ..." | ||
umount -l $R/proc 2> /dev/null | ||||
umount -l $R/sys 2> /dev/null | ||||
umount -l $R/dev/pts 2> /dev/null | ||||
umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null | ||||
umount "$BUILDDIR/mount" 2> /dev/null | ||||
Vincent Knecht
|
r66 | losetup -d "$ROOT_LOOP" 2> /dev/null | ||
losetup -d "$FRMW_LOOP" 2> /dev/null | ||||
Filip Pytloun
|
r56 | trap - 0 1 2 3 6 | ||
} | ||||
chroot_exec() { | ||||
# Exec command in chroot | ||||
Filip Pytloun
|
r58 | LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot $R $* | ||
Filip Pytloun
|
r56 | } | ||
Jan Wagner
|
r67 | |||
install_readonly() { | ||||
# Install file with user read-only permissions | ||||
install -o root -g root -m 644 $* | ||||
} | ||||
install_exec() { | ||||
# Install file with root exec permissions | ||||
install -o root -g root -m 744 $* | ||||
} | ||||