live-build/scripts/build/chroot_tmpfs

72 lines
1.6 KiB
Plaintext
Raw Normal View History

2010-09-26 10:38:38 +00:00
#!/bin/sh
## live-build(7) - System Build Scripts
## Copyright (C) 2016-2020 The Debian Live team
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
2010-09-26 10:38:38 +00:00
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
2010-09-26 10:38:38 +00:00
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
set -e
# Including common functions
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
2010-09-26 10:38:38 +00:00
# Setting static variables
DESCRIPTION="Use tmpfs to speedup the build"
2010-09-26 10:38:38 +00:00
USAGE="${PROGRAM} {install|remove} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
2010-09-26 10:38:38 +00:00
if [ "${LB_BUILD_WITH_TMPFS}" != "true" ]
then
exit 0
fi
2010-09-26 10:38:38 +00:00
# Requiring stage file
Require_stagefiles config bootstrap
2010-09-26 10:38:38 +00:00
case "${1}" in
install)
Echo_message "Configuring tmpfs for /var/lib/dpkg"
# Checking stage file
Check_stagefile
2010-09-26 10:38:38 +00:00
2020-03-13 15:19:59 -01:00
# Acquire lock file
Acquire_lockfile
2010-09-26 10:38:38 +00:00
mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp
mkdir chroot/var/lib/dpkg
mount -t tmpfs -o x-gvfs-hide tmpfs chroot/var/lib/dpkg
2010-09-26 10:38:38 +00:00
mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg
rm -rf chroot/var/lib/dpkg.tmp
# Creating stage file
Create_stagefile
2010-09-26 10:38:38 +00:00
;;
remove)
Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
2020-03-13 15:19:59 -01:00
# Acquire lock file
Acquire_lockfile
2010-09-26 10:38:38 +00:00
mkdir -p chroot/var/lib/dpkg.tmp
mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp
umount chroot/var/lib/dpkg
rm -rf chroot/var/lib/dpkg
mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg
# Removing stage file
Remove_stagefile
2010-09-26 10:38:38 +00:00
;;
*)
Usage 1
2010-09-26 10:38:38 +00:00
;;
esac