1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-14 07:27:10 +01:00
build/pkg/rootfs/build
David Oberhollenzer 94cc2d2c46 Implement board/product config schema
- build needs a pair of product and board name
 - some products can only be built for some boards
 - Config files in product/<name> directory override those in board/<name>
 - For some config files, like LDPATH or ROOTFS, the files are merged
 - product/common provides defaults

Add default config for various services:
 - Add default config for unbound
 - Add default config for dnsmasq

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24 18:28:29 +01:00

55 lines
1.4 KiB
Text
Executable file

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
local SOURCE="$1"
local DEPLOY="$2"
# setup skeleton
mkdir -pv ${PKGBUILDDIR}/{bin,lib,etc,dev,sys,proc,tmp,var,run}
mkdir -pv ${PKGBUILDDIR}/{boot,usr,srv,mnt,opt}
mkdir -pv ${PKGBUILDDIR}/cfg/{preserve,overlay}
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$PKGBUILDDIR"
cp -r "$SCRIPTDIR/pkg/$PKGNAME/lib" "$PKGBUILDDIR"
# install packages to rootfs
dependencies | tsort | tac | \
grep -v "$PKGNAME" > "$PKGBUILDDIR/etc/packages"
while read pkgname; do
if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then
continue
fi
cp -ru --remove-destination ${PKGDEPLOYDIR}/${pkgname}/* \
"$PKGBUILDDIR"
done < "$PKGBUILDDIR/etc/packages"
# version info
local fname=$(echo "${OS_NAME}-release" | tr '[:upper:]' '[:lower:]')
echo $OS_RELEASE > $PKGBUILDDIR/etc/$fname
# setup root home directory
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/root"
chmod 750 "$PKGBUILDDIR/root"
# move configuration to preserve directory
mv ${PKGBUILDDIR}/etc ${PKGBUILDDIR}/cfg/preserve
mkdir -p ${PKGBUILDDIR}/etc
mv ${PKGBUILDDIR}/var/lib ${PKGBUILDDIR}/cfg/preserve/var_lib
mv ${PKGBUILDDIR}/root ${PKGBUILDDIR}/cfg/preserve
mkdir -p ${PKGBUILDDIR}/root
chmod 750 ${PKGBUILDDIR}/root
chmod 750 ${PKGBUILDDIR}/cfg/preserve/root
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
mksquashfs "$PKGBUILDDIR" "$DEPLOY/rootfs.img" -comp xz \
-all-root -no-progress -no-xattrs
}