~ce-infrastructure/live-build/lb-sg-2.x

« back to all changes in this revision

Viewing changes to helpers/lh_chroot_localpackageslists

  • Committer: Daniel Baumann
  • Date: 2011-03-09 17:18:29 UTC
  • Revision ID: daniel@debian.org-20110309171829-b7tyrxub0nimlo0z
Adding live-helper 1.0~a10-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
# lh_chroot_localpackageslists(1) - install local packages lists into chroot
4
 
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
5
 
#
6
 
# live-helper 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
 
set -e
11
 
 
12
 
# Source common functions
13
 
for FUNCTION in /usr/share/live-helper/functions/*.sh
14
 
do
15
 
        . ${FUNCTION}
16
 
done
17
 
 
18
 
# Set static variables
19
 
DESCRIPTION="install local packages into chroot"
20
 
HELP=""
21
 
USAGE="${PROGRAM} [--force]"
22
 
 
23
 
Arguments "${@}"
24
 
 
25
 
Echo_debug "Init ${PROGRAM}"
26
 
 
27
 
# Reading configuration files
28
 
Read_conffile config/common
29
 
Read_conffile config/bootstrap
30
 
Read_conffile config/chroot
31
 
Read_conffile config/binary
32
 
Read_conffile config/source
33
 
Set_defaults
34
 
 
35
 
Breakpoint "chroot_localpackageslists: Init"
36
 
 
37
 
# Requiring stage file
38
 
Require_stagefile .stage/bootstrap
39
 
 
40
 
# Checking stage file
41
 
Check_stagefile .stage/chroot_localpackageslists
42
 
 
43
 
# Checking lock file
44
 
Check_lockfile .lock
45
 
 
46
 
# Creating lock file
47
 
Create_lockfile .lock
48
 
 
49
 
if ls config/chroot_localpackageslists/* &> /dev/null
50
 
then
51
 
        # Restoring cache
52
 
        Restore_cache cache/packages_localpackageslists
53
 
 
54
 
        for PACKAGESLIST in config/chroot_localpackageslists/*
55
 
        do
56
 
                # Copying package list
57
 
                grep -v "^#" "${PACKAGESLIST}" > chroot/root/"`basename ${PACKAGESLIST}`"
58
 
 
59
 
                # Installing package list
60
 
                case "${LH_APT}" in
61
 
                        apt|apt-get)
62
 
                                Chroot "xargs --arg-file=/root/`basename ${PACKAGESLIST}` apt-get install --yes"
63
 
                                ;;
64
 
 
65
 
                        aptitude)
66
 
                                Chroot "xargs --arg-file=/root/`basename ${PACKAGESLIST}` aptitude install --assume-yes"
67
 
                                ;;
68
 
                esac
69
 
 
70
 
                # Removing package list
71
 
                rm -f chroot/root/"`basename ${PACKAGESLIST}`"
72
 
        done
73
 
 
74
 
        # Saving cache
75
 
        Save_cache cache/packages_localpackageslists
76
 
 
77
 
        # Creating stage file
78
 
        Create_stagefile .stage/chroot_localpackageslists
79
 
fi