File tree Expand file tree Collapse file tree 1 file changed +40
-3
lines changed Expand file tree Collapse file tree 1 file changed +40
-3
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash -e
1
+ #! /bin/bash
2
2
3
3
# Copyright (C) 2018 Gunter Miegel coinboot.io
4
4
#
8
8
9
9
# Helper script to convert initramfs archive into a Docker container.
10
10
11
- INITRAMFS=$( readlink -f $1 )
11
+ display_help () {
12
+ echo
13
+ echo ' Coinbootmaker creates an environment for building Coinboot plugins from an'
14
+ echo ' given Coinboot Initramfs.'
15
+ echo
16
+ echo ' When no arguments beside the path to a Coinboot Initramfs is supplied'
17
+ echo ' Coinbootmaker automatically builds all plugins from the ./src directory.'
18
+ echo ' Packaged Coinboot pluings are written to the ./builds directory'
19
+ echo
20
+ echo ' Usage: coinbootmaker [-i] <path to initramfs>'
21
+ echo
22
+ echo ' -i Interactive mode - opens a shell in the build environment'
23
+ echo ' -h Display this help'
24
+ echo
25
+ }
26
+
27
+ while getopts " ih" opt; do
28
+ case $opt in
29
+ i)
30
+ interactive=true
31
+ ;;
32
+ h)
33
+ display_help
34
+ exit 1
35
+ ;;
36
+ \? )
37
+ echo " Invalid option: -$OPTARG " >&2
38
+ ;;
39
+ esac
40
+ done
41
+
42
+ shift $(( OPTIND - 1 ))
43
+
12
44
BASEDIR=$PWD
45
+ INITRAMFS=$1
13
46
WORKING_DIRECTORY=/tmp/$( basename $INITRAMFS ) _extracted_by_-coinbootmaker
14
47
15
48
install -d cache
@@ -39,7 +72,11 @@ if ! grep -q '200000' /proc/sys/fs/inotify/max_user_watches; then
39
72
echo ' 200000' | sudo tee /proc/sys/fs/inotify/max_user_watches
40
73
fi
41
74
42
- docker run --rm -it -v " $PWD " :/mnt coinbootmaker bash -c ' cd /mnt/build/ && run-parts /mnt/src'
75
+ if [ $interactive = ' true' ]; then
76
+ docker run --rm -it -v " $PWD " :/mnt coinbootmaker bash
77
+ else
78
+ docker run --rm -it -v " $PWD " :/mnt coinbootmaker bash -c ' cd /mnt/build/ && run-parts /mnt/src'
79
+ fi
43
80
44
81
echo " Cleaning up $WORKING_DIRECTORY "
45
82
rm -rf $WORKING_DIRECTORY
You can’t perform that action at this time.
0 commit comments