1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-05-18 03:26:14 +02:00
build/pkg/rootfs/build
David Oberhollenzer b1bdce20a9 Add automatic update chacking script
Crunch project websites and try to find the latest version for each
package without having to do the work manually.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-05-08 15:01:23 +02:00

65 lines
1.7 KiB
Plaintext
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,mnt}
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
# remove write flag from all static files/directories
find $PKGBUILDDIR/{bin,lib,share} -type f -exec chmod a-w {} \;
find $PKGBUILDDIR/{bin,lib,share} -type d -exec chmod a-w {} \;
# setup root home directory
mkdir -p "$PKGBUILDDIR/cfg/preserve/usr"
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/cfg/preserve/usr/root"
chmod 750 "$PKGBUILDDIR/cfg/preserve/usr/root"
# move configuration to preserve directory
mv "$PKGBUILDDIR/etc" "$PKGBUILDDIR/cfg/preserve"
mv "$PKGBUILDDIR/var/lib" "$PKGBUILDDIR/cfg/preserve/var_lib"
rm -rf "$PKGBUILDDIR/var"
mkdir -p ${PKGBUILDDIR}/{etc,var}
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
mksquashfs "$PKGBUILDDIR" "$DEPLOY/rootfs.img" -comp xz \
-all-root -no-progress -no-xattrs
# add write flag again, so we can remove the build directory
find $PKGBUILDDIR/{bin,lib,share} -type d -exec chmod u+w {} \;
find $PKGBUILDDIR/{bin,lib,share} -type f -exec chmod u+w {} \;
}
check_update() {
return
}