source: live-build/trunk/fuentes/scripts/build/lb_chroot_tmpfs @ 900

Last change on this file since 900 was 900, checked in by kbut, 4 years ago

add original source

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/sh
2
3## live-build(7) - System Build Scripts
4## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
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.
9
10
11set -e
12
13# Including common functions
14( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
15
16# Setting static variables
17DESCRIPTION="$(Echo 'use tmpfs to speedup the build')"
18HELP=""
19USAGE="${PROGRAM} {install|remove} [--force]"
20
21Arguments "${@}"
22
23# Reading configuration files
24Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25Set_defaults
26
27if [ "${LB_BUILD_WITH_TMPFS}" != "true" ]
28then
29        exit 0
30fi
31
32# Requiring stage file
33Require_stagefile .build/config .build/bootstrap
34
35case "${1}" in
36        install)
37                Echo_message "Configuring tmpfs for /var/lib/dpkg"
38
39                # Checking stage file
40                Check_stagefile .build/chroot_tmpfs
41
42                # Checking lock file
43                Check_lockfile .lock
44
45                # Creating lock file
46                Create_lockfile .lock
47
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
53
54                # Creating stage file
55                Create_stagefile .build/chroot_tmpfs
56                ;;
57
58        remove)
59                Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
60
61                # Checking lock file
62                Check_lockfile .lock
63
64                # Creating lock file
65                Create_lockfile .lock
66
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
72
73                # Removing stage file
74                rm -f .build/chroot_tmpfs
75                ;;
76
77        *)
78                Usage
79                ;;
80esac
Note: See TracBrowser for help on using the repository browser.