summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-02-27 22:53:03 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2018-02-27 22:53:03 +0100
commitbe3a3f756fdaf11a0f2ef0fef85e6c20ea2ea524 (patch)
tree2a35c70e1b384059e7bc21b5281fe1e937fd197b
parent310df2d2a3f37eeb9596837f7886f86badc40ded (diff)
Install custom packages in build_rootfs.sh
-rwxr-xr-xbuild.sh2
-rwxr-xr-xbuild_rootfs.sh35
2 files changed, 33 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index f959dd5..7c52504 100755
--- a/build.sh
+++ b/build.sh
@@ -127,7 +127,7 @@ build_tarball() {
export SDK="$(pwd)/${sdk}"
export ARCH=${arch}
export SUBARCH=${subarch}
- fakeroot ./build_rootfs.sh $rootfs $metadata $lxc_tar
+ fakeroot ./build_rootfs.sh $rootfs $metadata -o $lxc_tar --packages="${packages}"
}
build_metadata() {
diff --git a/build_rootfs.sh b/build_rootfs.sh
index e659187..4eb172a 100755
--- a/build_rootfs.sh
+++ b/build_rootfs.sh
@@ -2,15 +2,35 @@
set -e
-if [ $# -ne 3 ]; then
- echo "Usage: $0 <src tar> <metadata.yaml> <dst file>"
+usage() {
+ echo "Usage: $0 [-o|--output <dst file>] <src tar> <metadata.yaml>"
exit 1
+}
+
+dst_file=/dev/stdout
+
+temp=$(getopt -o "o:p:" -l "output:,packages:,help" -- "$@")
+eval set -- "$temp"
+while true; do
+ case "$1" in
+ -p|--packages)
+ packages="$2"; shift 2;;
+ -o)
+ dst_file="$2"; shift 2;;
+ --help)
+ usage;;
+ --)
+ shift; break;;
+ esac
+done
+
+if [ $# -ne 2 ]; then
+ usage
fi
src_tar=$1
metadata_dir=`dirname $2`
metadata=`basename $2`
-dst_file=$3
base=`basename $src_tar`
dir=/tmp/build.$$
files_dir=files/
@@ -87,11 +107,20 @@ update_packages() {
done
}
+install_packages() {
+ local packages="$1"
+ for pkg in $packages; do
+ echo Install $pkg
+ $OPKG install $pkg
+ done
+}
+
unpack
add_files $files_dir $instroot
add_file $metadata $metadata_dir $dir
add_files templates/ $dir/templates/
add_packages bin/packages/${ARCH}/${SUBARCH}
update_packages
+install_packages "$packages"
pack
#pack_squashfs