2010-09-26 10:38:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2010-09-26 10:38:38 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +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
|
2012-08-27 13:52:29 +00:00
|
|
|
[ -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
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Use tmpfs to speedup the build"
|
2010-09-26 10:38:38 +00:00
|
|
|
USAGE="${PROGRAM} {install|remove} [--force]"
|
|
|
|
|
2015-02-05 02:30:47 -01:00
|
|
|
# Processing arguments and configuration files
|
|
|
|
Init_config_data "${@}"
|
2010-09-26 10:38:38 +00:00
|
|
|
|
2010-10-28 07:51:55 +00:00
|
|
|
if [ "${LB_BUILD_WITH_TMPFS}" != "true" ]
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-09-26 10:38:38 +00:00
|
|
|
# Requiring stage file
|
2020-03-15 12:05:44 -01:00
|
|
|
Require_stagefiles config bootstrap
|
2020-03-12 00:21:39 -01:00
|
|
|
|
2010-09-26 10:38:38 +00:00
|
|
|
case "${1}" in
|
|
|
|
install)
|
|
|
|
Echo_message "Configuring tmpfs for /var/lib/dpkg"
|
|
|
|
|
|
|
|
# Checking stage file
|
2020-03-13 16:11:53 -01:00
|
|
|
Check_stagefile
|
2010-09-26 10:38:38 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
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
|
2020-03-12 13:52:58 -01:00
|
|
|
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
|
2020-03-13 16:11:53 -01:00
|
|
|
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
|
2015-02-05 02:30:47 -01:00
|
|
|
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
|
2020-03-13 16:11:53 -01:00
|
|
|
Remove_stagefile
|
2010-09-26 10:38:38 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2020-04-23 14:38:59 +00:00
|
|
|
Usage --fail
|
2010-09-26 10:38:38 +00:00
|
|
|
;;
|
|
|
|
esac
|