~linaro-maintainers/live-build/linaro-live-build-3

« back to all changes in this revision

Viewing changes to scripts/build/lb_chroot_dpkg_tmpfs

  • Committer: Daniel Baumann
  • Date: 2011-03-09 18:19:23 UTC
  • Revision ID: git-v1:c5c3f6133a0fb62ba9c2c3b839e6ea5774f9c76a
Adding debian version 3.0~a1-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
## live-build(7) - System Build Scripts
 
4
## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
 
5
##
 
6
## live-build 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
 
 
11
set -e
 
12
 
 
13
# Including common functions
 
14
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
 
15
 
 
16
# Setting static variables
 
17
DESCRIPTION="$(Echo 'manage /var/lib/dpkg')"
 
18
HELP=""
 
19
USAGE="${PROGRAM} {install|remove} [--force]"
 
20
 
 
21
Arguments "${@}"
 
22
 
 
23
# Reading configuration files
 
24
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
 
25
Set_defaults
 
26
 
 
27
# Requiring stage file
 
28
Require_stagefile .stage/config .stage/bootstrap
 
29
 
 
30
case "${1}" in
 
31
        install)
 
32
                Echo_message "Configuring tmpfs for /var/lib/dpkg"
 
33
 
 
34
                # Checking stage file
 
35
                Check_stagefile .stage/chroot_dpkg_tmpfs
 
36
 
 
37
                # Checking lock file
 
38
                Check_lockfile .lock
 
39
 
 
40
                # Creating lock file
 
41
                Create_lockfile .lock
 
42
 
 
43
                mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp
 
44
                mkdir chroot/var/lib/dpkg
 
45
                mount -t tmpfs tmpfs chroot/var/lib/dpkg
 
46
                mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg
 
47
                rm -rf chroot/var/lib/dpkg.tmp
 
48
 
 
49
                # Creating stage file
 
50
                Create_stagefile .stage/chroot_dpkg_tmpfs
 
51
                ;;
 
52
 
 
53
        remove)
 
54
                Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
 
55
 
 
56
                # Checking lock file
 
57
                Check_lockfile .lock
 
58
 
 
59
                # Creating lock file
 
60
                Create_lockfile .lock
 
61
 
 
62
                mkdir -p chroot/var/lib/dpkg.tmp
 
63
                mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp
 
64
                umount chroot/var/lib/dpkg
 
65
                rm -rf chroot/var/lib/dpkg
 
66
                mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg
 
67
 
 
68
                # Removing stage file
 
69
                rm -f .stage/chroot_dpkg_tmpfs
 
70
                ;;
 
71
 
 
72
        *)
 
73
                Usage
 
74
                ;;
 
75
esac