Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tails
live-build
Commits
6ed737c9
Commit
6ed737c9
authored
Nov 04, 2013
by
Daniel Baumann
Browse files
Adding upstream version 4.0~alpha30.
parent
68ca1cd4
Changes
110
Hide whitespace changes
Inline
Side-by-side
VERSION
View file @
6ed737c9
4.0~alpha
29
-1
4.0~alpha
30
-1
components/binary
_
hooks
→
components/binary
-
hooks
View file @
6ed737c9
...
...
@@ -25,11 +25,11 @@ import sys
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb binary
_
hooks'
,
prog
=
'lb binary
-
hooks'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The binary
_
hooks command executes hooks after the binary stage.'''
,
epilog
=
'See
\'
man lb
_
binary
_
hooks
\'
for more information.'
,
The binary
-
hooks command executes hook
file
s after the binary stage.'''
,
epilog
=
'See
\'
man lb
-
binary
-
hooks
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -41,12 +41,12 @@ def main():
# --verbose
verbose
=
args
.
verbose
##
Executing
hooks
##
Calling binary
hooks
# stagefile
if
os
.
path
.
isfile
(
'.build/binary
_
hooks'
):
if
os
.
path
.
isfile
(
'.build/binary
-
hooks'
):
if
verbose
:
print
(
'I: binary
_
hooks already done - nothing to do'
)
print
(
'I: binary
-
hooks already done - nothing to do'
)
sys
.
exit
(
0
)
...
...
@@ -101,7 +101,7 @@ def main():
## stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/binary
_
hooks'
,
'w'
).
close
()
open
(
'.build/binary
-
hooks'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
...
...
components/binary-includes
0 → 100755
View file @
6ed737c9
#!/usr/bin/python3
## live-build(7) - Live System Build Components
## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
import
argparse
import
configparser
import
glob
import
os
import
shutil
import
subprocess
import
sys
# TODO:
# * logfile output
# * lockfile handling
# * use gettext for i18n
# * derefence or remove symlinks if binary filesystem does not support them
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb binary-includes'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The binary-includes command copies include files into the binary stage.'''
,
epilog
=
'See
\'
man lb-binary-includes
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
arguments
.
add_argument
(
'--version'
,
help
=
'show program
\'
s version number and exit'
,
action
=
'version'
,
version
=
'live-build 4'
)
arguments
.
add_argument
(
'--verbose'
,
help
=
'set verbose option'
,
action
=
'store_true'
)
args
=
arguments
.
parse_args
()
# --verbose
verbose
=
args
.
verbose
## Copying binary includes
# stagefile
if
os
.
path
.
isfile
(
'.build/binary-includes'
):
if
verbose
:
print
(
'I: binary-includes already done - nothing to do'
)
sys
.
exit
(
0
)
# dependencies
if
not
os
.
path
.
isfile
(
'.build/bootstrap'
):
print
(
'E: bootstrap stage missing - aborting'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: use
\'
lb bootstrap
\'
to bootstrap system'
)
sys
.
exit
(
1
)
if
not
os
.
path
.
isfile
(
'/bin/cpio'
):
print
(
'E: /bin/cpio - no such file'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: cpio can be obtained from:
\n
'
'I: http://www.gnu.org/software/cpio/
\n
'
'I: http://ftp.gnu.org/gnu/cpio/
\n
'
'I: On Debian based systems, cpio can be installed with:
\n
'
'I: # sudo apt-get install cpio'
)
sys
.
exit
(
1
)
# includes
if
not
glob
.
glob
(
'config/includes/*'
)
and
not
glob
.
glob
(
'config/includes/.*'
)
and
not
glob
.
glob
(
'config/includes.binary/*'
)
and
not
glob
.
glob
(
'config/includes.binary/.*'
):
if
verbose
:
print
(
'I: no binary includes found at config/includes{,.binary} - nothing to do'
)
sys
.
exit
(
0
)
# process includes
if
glob
.
glob
(
'config/includes/*'
)
or
glob
.
glob
(
'config/includes/.*'
):
hooks
=
glob
.
glob
(
'config/includes/*'
)
+
glob
.
glob
(
'config/includes/.*'
)
if
verbose
:
print
(
'I: Copying config/includes to binary'
)
cpio
=
subprocess
.
call
(
'cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../binary'
,
shell
=
True
)
if
glob
.
glob
(
'config/includes.binary/*'
)
and
not
glob
.
glob
(
'config/includes.binary/.*'
):
hooks
=
glob
.
glob
(
'config/includes.binary/*'
)
+
glob
.
glob
(
'config/includes.binary/.*'
)
if
verbose
:
print
(
'I: Copying config/includes.binary to binary'
)
cpio
=
subprocess
.
call
(
'cd config/includes.binary && find . | cpio -dmpu --no-preserve-owner ../../binary'
,
shell
=
True
)
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/binary-includes'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
main
()
components/bootstrap
_
cdebootstrap
→
components/bootstrap
-
cdebootstrap
View file @
6ed737c9
...
...
@@ -21,17 +21,17 @@ import sys
# * logfile output
# * lockfile handling
# * use gettext for i18n
# * cdebootstrap-options from config
# * take mirrors from config/archives/
debian
.{bootstrap,chroot}
# * cdebootstrap-options from config
/options/cdebootstrap
# * take mirrors from config/archives/
mirror
.{bootstrap,chroot}
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb bootstrap
_
cdebootstrap'
,
prog
=
'lb bootstrap
-
cdebootstrap'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The bootstrap
_
cdebootstrap command bootstraps the chroot system with cdebootstrap.'''
,
epilog
=
'See
\'
man lb
_
bootstrap
_
cdebootstrap
\'
for more information.'
,
The bootstrap
-
cdebootstrap command bootstraps the chroot system with cdebootstrap.'''
,
epilog
=
'See
\'
man lb
-
bootstrap
-
cdebootstrap
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -89,7 +89,7 @@ def main():
print
(
'E: /usr/bin/cdebootstrap - no such file'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: cdebootstrap can be o
p
tained from:
\n
'
print
(
'I: cdebootstrap can be o
b
tained from:
\n
'
'I: http://anonscm.debian.org/gitweb/?p=users/waldi/cdebootstrap.git
\n
'
'I: http://ftp.debian.org/debian/pool/main/c/cdebootstrap/
\n
'
'I: On Debian based systems, cdebootstrap can be installed with:
\n
'
...
...
@@ -105,8 +105,23 @@ def main():
print
(
'I: use
\'
lb clean
\'
to clean up a previously incomplete build'
)
sys
.
exit
(
1
)
# stage cache
if
os
.
path
.
exists
(
'cache/bootstrap'
):
if
verbose
:
print
(
'I: Copying cache/bootstrap to chroot'
)
# Notes:
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
cache
=
subprocess
.
call
(
'cp -a cache/bootstrap chroot'
,
shell
=
True
)
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap'
,
'w'
).
close
()
sys
.
exit
(
0
)
# packages cache
el
if
glob
.
glob
(
'cache/packages.bootstrap/*.deb'
):
if
glob
.
glob
(
'cache/packages.bootstrap/*.deb'
):
if
verbose
:
print
(
'I: Copying cache/packages.bootstrap/*.deb to chroot/var/cache/bootstrap/*.deb'
)
...
...
@@ -150,7 +165,16 @@ def main():
cdebootstrap
=
subprocess
.
call
(
'/usr/bin/cdebootstrap '
+
cdebootstrap_options
,
shell
=
True
)
## stagefile
# stage cache
if
not
os
.
path
.
exists
(
'cache/bootstrap'
):
if
verbose
:
print
(
'I: Copying chroot to cache/bootstrap'
)
# Notes:
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
cache
=
subprocess
.
call
(
'cp -a chroot cache/bootstrap'
,
shell
=
True
)
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap'
,
'w'
).
close
()
...
...
components/bootstrap
_
debootstrap
→
components/bootstrap
-
debootstrap
View file @
6ed737c9
...
...
@@ -21,17 +21,17 @@ import sys
# * logfile output
# * lockfile handling
# * use gettext for i18n
# * debootstrap-options from config
# * take mirrors from config/archives/
debian
.{bootstrap,chroot}
# * debootstrap-options from config
/options/debootstrap
# * take mirrors from config/archives/
mirror
.{bootstrap,chroot}
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb bootstrap
_
debootstrap'
,
prog
=
'lb bootstrap
-
debootstrap'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The bootstrap
_
debootstrap command bootstraps the chroot system with debootstrap.'''
,
epilog
=
'See
\'
man lb
_
bootstrap
_
debootstrap
\'
for more information.'
,
The bootstrap
-
debootstrap command bootstraps the chroot system with debootstrap.'''
,
epilog
=
'See
\'
man lb
-
bootstrap
-
debootstrap
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -94,7 +94,7 @@ def main():
print
(
'E: /usr/sbin/debootstrap - no such file'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: debootstrap can be o
p
tained from:
\n
'
print
(
'I: debootstrap can be o
b
tained from:
\n
'
'I: http://anonscm.debian.org/gitweb/?p=d-i/debootstrap.git
\n
'
'I: http://ftp.debian.org/debian/pool/main/d/debootstrap/
\n
'
'I: On Debian based systems, debootstrap can be installed with:
\n
'
...
...
@@ -110,8 +110,23 @@ def main():
print
(
'I: use
\'
lb clean
\'
to clean up a previously incomplete build'
)
sys
.
exit
(
1
)
# stage cache
if
os
.
path
.
exists
(
'cache/bootstrap'
):
if
verbose
:
print
(
'I: Copying cache/bootstrap to chroot'
)
# Notes:
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
cache
=
subprocess
.
call
(
'cp -a cache/bootstrap chroot'
,
shell
=
True
)
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap'
,
'w'
).
close
()
sys
.
exit
(
0
)
# packages cache
el
if
glob
.
glob
(
'cache/packages.bootstrap/*.deb'
):
if
glob
.
glob
(
'cache/packages.bootstrap/*.deb'
):
if
verbose
:
print
(
'I: Copying cache/packages.bootstrap/*.deb to chroot/var/cache/apt/archives/*.deb'
)
...
...
@@ -147,7 +162,16 @@ def main():
for
package
in
glob
.
glob
(
'chroot/var/cache/apt/archives/*.deb'
):
shutil
.
move
(
package
,
'cache/packages.bootstrap'
)
## stagefile
# stage cache
if
not
os
.
path
.
exists
(
'cache/bootstrap'
):
if
verbose
:
print
(
'I: Copying chroot to cache/bootstrap'
)
# Notes:
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
cache
=
subprocess
.
call
(
'cp -a chroot cache/bootstrap'
,
shell
=
True
)
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap'
,
'w'
).
close
()
...
...
components/bootstrap
_
hooks
→
components/bootstrap
-
hooks
View file @
6ed737c9
...
...
@@ -25,11 +25,11 @@ import sys
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb bootstrap
_
hooks'
,
prog
=
'lb bootstrap
-
hooks'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The bootstrap
_
hooks command executes hooks after the bootstrap stage.'''
,
epilog
=
'See
\'
man lb
_
bootstrap
_
hooks
\'
for more information.'
,
The bootstrap
-
hooks command executes hook
file
s after the bootstrap stage.'''
,
epilog
=
'See
\'
man lb
-
bootstrap
-
hooks
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -41,12 +41,12 @@ def main():
# --verbose
verbose
=
args
.
verbose
##
Executing
hooks
##
Calling bootstrap
hooks
# stagefile
if
os
.
path
.
isfile
(
'.build/bootstrap
_
hooks'
):
if
os
.
path
.
isfile
(
'.build/bootstrap
-
hooks'
):
if
verbose
:
print
(
'I: bootstrap
_
hooks already done - nothing to do'
)
print
(
'I: bootstrap
-
hooks already done - nothing to do'
)
sys
.
exit
(
0
)
...
...
@@ -99,9 +99,9 @@ def main():
os
.
rmdir
(
'chroot/live-build/config'
)
os
.
rmdir
(
'chroot/live-build'
)
#
#
stagefile
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap
_
hooks'
,
'w'
).
close
()
open
(
'.build/bootstrap
-
hooks'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
...
...
components/bootstrap-includes
0 → 100755
View file @
6ed737c9
#!/usr/bin/python3
## live-build(7) - Live System Build Components
## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
import
argparse
import
configparser
import
glob
import
os
import
shutil
import
subprocess
import
sys
# TODO:
# * logfile output
# * lockfile handling
# * use gettext for i18n
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb bootstrap-includes'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The bootstrap-includes command copies include files into the bootstrap stage.'''
,
epilog
=
'See
\'
man lb-bootstrap-includes
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
arguments
.
add_argument
(
'--version'
,
help
=
'show program
\'
s version number and exit'
,
action
=
'version'
,
version
=
'live-build 4'
)
arguments
.
add_argument
(
'--verbose'
,
help
=
'set verbose option'
,
action
=
'store_true'
)
args
=
arguments
.
parse_args
()
# --verbose
verbose
=
args
.
verbose
## Copying bootstrap includes
# stagefile
if
os
.
path
.
isfile
(
'.build/bootstrap-includes'
):
if
verbose
:
print
(
'I: bootstrap-includes already done - nothing to do'
)
sys
.
exit
(
0
)
# dependencies
if
not
os
.
path
.
isfile
(
'.build/bootstrap'
):
print
(
'E: bootstrap stage missing - aborting'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: use
\'
lb bootstrap
\'
to bootstrap system'
)
sys
.
exit
(
1
)
if
not
os
.
path
.
isfile
(
'/bin/cpio'
):
print
(
'E: /bin/cpio - no such file'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: cpio can be obtained from:
\n
'
'I: http://www.gnu.org/software/cpio/
\n
'
'I: http://ftp.gnu.org/gnu/cpio/
\n
'
'I: On Debian based systems, cpio can be installed with:
\n
'
'I: # sudo apt-get install cpio'
)
sys
.
exit
(
1
)
# includes
if
not
glob
.
glob
(
'config/includes/*'
)
and
not
glob
.
glob
(
'config/includes/.*'
)
and
not
glob
.
glob
(
'config/includes.bootstrap/*'
)
and
not
glob
.
glob
(
'config/includes.bootstrap/.*'
):
if
verbose
:
print
(
'I: no bootstrap includes found at config/includes{,.bootstrap} - nothing to do'
)
sys
.
exit
(
0
)
# process includes
if
glob
.
glob
(
'config/includes/*'
)
or
glob
.
glob
(
'config/includes/.*'
):
hooks
=
glob
.
glob
(
'config/includes/*'
)
+
glob
.
glob
(
'config/includes/.*'
)
if
verbose
:
print
(
'I: Copying config/includes to chroot'
)
cpio
=
subprocess
.
call
(
'cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot'
,
shell
=
True
)
if
glob
.
glob
(
'config/includes.bootstrap/*'
)
and
not
glob
.
glob
(
'config/includes.bootstrap/.*'
):
hooks
=
glob
.
glob
(
'config/includes.bootstrap/*'
)
+
glob
.
glob
(
'config/includes.bootstrap/.*'
)
if
verbose
:
print
(
'I: Copying config/includes.bootstrap to chroot'
)
cpio
=
subprocess
.
call
(
'cd config/includes.bootstrap && find . | cpio -dmpu --no-preserve-owner ../../chroot'
,
shell
=
True
)
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/bootstrap-includes'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
main
()
components/chroot
_
hooks
→
components/chroot
-
hooks
View file @
6ed737c9
...
...
@@ -25,11 +25,11 @@ import sys
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb chroot
_
hooks'
,
prog
=
'lb chroot
-
hooks'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The chroot
_
hooks command executes hooks after the chroot stage.'''
,
epilog
=
'See
\'
man lb
_
chroot
_
hooks
\'
for more information.'
,
The chroot
-
hooks command executes hook
file
s after the chroot stage.'''
,
epilog
=
'See
\'
man lb
-
chroot
-
hooks
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -41,12 +41,12 @@ def main():
# --verbose
verbose
=
args
.
verbose
##
Executing
hooks
##
Calling chroot
hooks
# stagefile
if
os
.
path
.
isfile
(
'.build/chroot
_
hooks'
):
if
os
.
path
.
isfile
(
'.build/chroot
-
hooks'
):
if
verbose
:
print
(
'I: chroot
_
hooks already done - nothing to do'
)
print
(
'I: chroot
-
hooks already done - nothing to do'
)
sys
.
exit
(
0
)
...
...
@@ -99,9 +99,9 @@ def main():
os
.
rmdir
(
'chroot/live-build/config'
)
os
.
rmdir
(
'chroot/live-build'
)
#
#
stagefile
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/chroot
_
hooks'
,
'w'
).
close
()
open
(
'.build/chroot
-
hooks'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
...
...
components/chroot-includes
0 → 100755
View file @
6ed737c9
#!/usr/bin/python3
## live-build(7) - Live System Build Components
## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
import
argparse
import
configparser
import
glob
import
os
import
shutil
import
subprocess
import
sys
# TODO:
# * logfile output
# * lockfile handling
# * use gettext for i18n
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb chroot-includes'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The chroot-includes command copies include files into the chroot stage.'''
,
epilog
=
'See
\'
man lb-chroot-includes
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
arguments
.
add_argument
(
'--version'
,
help
=
'show program
\'
s version number and exit'
,
action
=
'version'
,
version
=
'live-build 4'
)
arguments
.
add_argument
(
'--verbose'
,
help
=
'set verbose option'
,
action
=
'store_true'
)
args
=
arguments
.
parse_args
()
# --verbose
verbose
=
args
.
verbose
## Copying chroot includes
# stagefile
if
os
.
path
.
isfile
(
'.build/chroot-includes'
):
if
verbose
:
print
(
'I: chroot-includes already done - nothing to do'
)
sys
.
exit
(
0
)
# dependencies
if
not
os
.
path
.
isfile
(
'.build/bootstrap'
):
print
(
'E: bootstrap stage missing - aborting'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: use
\'
lb bootstrap
\'
to bootstrap system'
)
sys
.
exit
(
1
)
if
not
os
.
path
.
isfile
(
'/bin/cpio'
):
print
(
'E: /bin/cpio - no such file'
,
file
=
sys
.
stderr
)
if
verbose
:
print
(
'I: cpio can be obtained from:
\n
'
'I: http://www.gnu.org/software/cpio/
\n
'
'I: http://ftp.gnu.org/gnu/cpio/
\n
'
'I: On Debian based systems, cpio can be installed with:
\n
'
'I: # sudo apt-get install cpio'
)
sys
.
exit
(
1
)
# includes
if
not
glob
.
glob
(
'config/includes/*'
)
and
not
glob
.
glob
(
'config/includes/.*'
)
and
not
glob
.
glob
(
'config/includes.chroot/*'
)
and
not
glob
.
glob
(
'config/includes.chroot/.*'
):
if
verbose
:
print
(
'I: no chroot includes found at config/includes{,.chroot} - nothing to do'
)
sys
.
exit
(
0
)
# process includes
if
glob
.
glob
(
'config/includes/*'
)
or
glob
.
glob
(
'config/includes/.*'
):
hooks
=
glob
.
glob
(
'config/includes/*'
)
+
glob
.
glob
(
'config/includes/.*'
)
if
verbose
:
print
(
'I: Copying config/includes to chroot'
)
cpio
=
subprocess
.
call
(
'cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot'
,
shell
=
True
)
if
glob
.
glob
(
'config/includes.chroot/*'
)
and
not
glob
.
glob
(
'config/includes.chroot/.*'
):
hooks
=
glob
.
glob
(
'config/includes.chroot/*'
)
+
glob
.
glob
(
'config/includes.chroot/.*'
)
if
verbose
:
print
(
'I: Copying config/includes.chroot to chroot'
)
cpio
=
subprocess
.
call
(
'cd config/includes.chroot && find . | cpio -dmpu --no-preserve-owner ../../chroot'
,
shell
=
True
)
# stagefile
os
.
makedirs
(
'.build'
,
exist_ok
=
True
)
open
(
'.build/chroot-includes'
,
'w'
).
close
()
if
__name__
==
'__main__'
:
main
()
components/source
_
hooks
→
components/source
-
hooks
View file @
6ed737c9
...
...
@@ -25,11 +25,11 @@ import sys
def
main
():
## Parsing Arguments
arguments
=
argparse
.
ArgumentParser
(
prog
=
'lb source
_
hooks'
,
prog
=
'lb source
-
hooks'
,
usage
=
'%(prog)s [arguments]'
,
description
=
'''live-build contains the components to build a live system from a configuration directory.
The source
_
hooks command executes hooks after the source stage.'''
,
epilog
=
'See
\'
man lb
_
source
_
hooks
\'
for more information.'
,
The source
-
hooks command executes hook
file
s after the source stage.'''
,
epilog
=
'See
\'
man lb
-
source
-
hooks
\'
for more information.'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
...
...
@@ -41,12 +41,12 @@ def main():
# --verbose
verbose
=
args
.
verbose
##
Executing
hooks
##
Calling source
hooks
# stagefile
if
os
.
path
.
isfile
(
'.build/source
_
hooks'
):
if
os
.
path
.
isfile
(
'.build/source
-
hooks'
):
if
verbose
:
print
(
'I: source
_
hooks already done - nothing to do'
)