Moving partial python rewrite to separate branch, let's do it in the jessie+1 cycle...
[debian-live-build.git] / scripts / build / chroot_tmpfs
blob8e9c0085cd2df2a55a42367f17213be1735ffb1b
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
5 ##
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
11 set -e
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
16 # Setting static variables
17 DESCRIPTION="$(Echo 'use tmpfs to speedup the build')"
18 HELP=""
19 USAGE="${PROGRAM} {install|remove} [--force]"
21 Arguments "${@}"
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25 Set_defaults
27 if [ "${LB_BUILD_WITH_TMPFS}" != "true" ]
28 then
29 exit 0
32 # Requiring stage file
33 Require_stagefile .build/config .build/bootstrap
35 case "${1}" in
36 install)
37 Echo_message "Configuring tmpfs for /var/lib/dpkg"
39 # Checking stage file
40 Check_stagefile .build/chroot_tmpfs
42 # Checking lock file
43 Check_lockfile .lock
45 # Creating lock file
46 Create_lockfile .lock
48 mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp
49 mkdir chroot/var/lib/dpkg
50 mount -t tmpfs tmpfs chroot/var/lib/dpkg
51 mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg
52 rm -rf chroot/var/lib/dpkg.tmp
54 # Creating stage file
55 Create_stagefile .build/chroot_tmpfs
58 remove)
59 Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
61 # Checking lock file
62 Check_lockfile .lock
64 # Creating lock file
65 Create_lockfile .lock
67 mkdir -p chroot/var/lib/dpkg.tmp
68 mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp
69 umount chroot/var/lib/dpkg
70 rm -rf chroot/var/lib/dpkg
71 mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg
73 # Removing stage file
74 rm -f .build/chroot_tmpfs
78 Usage
80 esac