mirror of
https://github.com/pygos/build.git
synced 2024-11-22 19:19:46 +01:00
ae57b55b9c
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
55 lines
1.3 KiB
Text
Executable file
55 lines
1.3 KiB
Text
Executable file
DEPENDS=$(cat "$SCRIPTDIR/board/$BOARD/ROOTFS")
|
|
|
|
build() {
|
|
local SOURCE="$1"
|
|
local BUILD="$2"
|
|
local DEPLOY="$3"
|
|
|
|
# setup skeleton
|
|
mkdir -pv ${BUILD}/{bin,lib,etc,dev,sys,proc,tmp,var,run}
|
|
mkdir -pv ${BUILD}/{boot,usr,srv,mnt,opt}
|
|
mkdir -pv ${BUILD}/cfg/{preserve,overlay}
|
|
|
|
echo "/lib" > "$BUILD/etc/ld-musl-${MUSL_CPU}.path"
|
|
|
|
if [ -e "$SCRIPTDIR/board/$BOARD/LDPATH" ]; then
|
|
cat "$SCRIPTDIR/board/$BOARD/LDPATH" >> "$BUILD/etc/ld-musl-${MUSL_CPU}.path"
|
|
fi
|
|
|
|
cp -r "$SCRIPTDIR/$PKGDIR/$PKGNAME/etc" "$BUILD"
|
|
|
|
# install packages to rootfs
|
|
dependencies | tsort | tac | grep -v "$PKGNAME" > "$BUILD/etc/packages"
|
|
echo "toolchain" >> "$BUILD/etc/packages"
|
|
|
|
while read pkgname; do
|
|
if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then
|
|
continue
|
|
fi
|
|
|
|
cp -ru --remove-destination ${PKGDEPLOYDIR}/${pkgname}/* "$BUILD"
|
|
done < "$BUILD/etc/packages"
|
|
|
|
# setup root home directory
|
|
cp -r "$BUILD/etc/skel" "$BUILD/root"
|
|
chmod 750 "$BUILD/root"
|
|
|
|
# move configuration to preserve directory
|
|
mv ${BUILD}/etc ${BUILD}/cfg/preserve
|
|
mkdir -p ${BUILD}/etc
|
|
|
|
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
|
|
|
|
mv ${BUILD}/root ${BUILD}/cfg/preserve
|
|
mkdir -p ${BUILD}/root
|
|
chmod 750 ${BUILD}/root
|
|
chmod 750 ${BUILD}/cfg/preserve/root
|
|
}
|
|
|
|
deploy() {
|
|
local SOURCE="$1"
|
|
local BUILD="$2"
|
|
local DEPLOY="$3"
|
|
|
|
mksquashfs "$BUILD" "$DEPLOY/rootfs.img" -all-root -no-progress -no-xattrs
|
|
}
|