mirror of
https://github.com/pygos/build.git
synced 2024-11-21 18:49:46 +01:00
Cleanup rootfs package
- move the skeleton setup stuff out of the rootfs package into a sperate package called "basefiles" - remove manual unpacking from rootfs, we already have all the dependencies installed in the toolchain sysroot. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
93a0cb1ca5
commit
26a9b8002f
14 changed files with 80 additions and 74 deletions
|
@ -1,3 +1,4 @@
|
|||
basefiles
|
||||
bash
|
||||
bash-completion
|
||||
coreutils
|
||||
|
|
1
pkg/basefiles/basefiles.desc
Normal file
1
pkg/basefiles/basefiles.desc
Normal file
|
@ -0,0 +1 @@
|
|||
name basefiles
|
24
pkg/basefiles/basefiles.files
Normal file
24
pkg/basefiles/basefiles.files
Normal file
|
@ -0,0 +1,24 @@
|
|||
dir bin 0755 0 0
|
||||
dir lib 0755 0 0
|
||||
dir dev 0755 0 0
|
||||
dir etc 0755 0 0
|
||||
dir sys 0755 0 0
|
||||
dir proc 0755 0 0
|
||||
dir tmp 0755 0 0
|
||||
dir run 0755 0 0
|
||||
dir boot 0755 0 0
|
||||
dir usr 0755 0 0
|
||||
dir mnt 0755 0 0
|
||||
dir share 0755 0 0
|
||||
dir var 0755 0 0
|
||||
dir etc/profile.d 0755 0 0
|
||||
dir etc/skel 0755 0 0
|
||||
dir var/lib 0755 0 0
|
||||
dir lib/libexec 0755 0 0
|
||||
slink etc/mtab 0777 0 0 /proc/self/mounts
|
||||
file etc/group 0644 0 0
|
||||
file etc/hostname 0644 0 0
|
||||
file etc/hosts 0644 0 0
|
||||
file etc/passwd 0644 0 0
|
||||
file etc/shadow 0644 0 0
|
||||
file lib/charset.alias 0644 0 0
|
27
pkg/basefiles/build
Normal file
27
pkg/basefiles/build
Normal file
|
@ -0,0 +1,27 @@
|
|||
build() {
|
||||
return
|
||||
}
|
||||
|
||||
deploy() {
|
||||
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
|
||||
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$PKGDEPLOYDIR"
|
||||
cp -r "$SCRIPTDIR/pkg/$PKGNAME/lib" "$PKGDEPLOYDIR"
|
||||
|
||||
# version info
|
||||
local fname=$(echo "${OS_NAME}-release" | tr '[:upper:]' '[:lower:]')
|
||||
echo "$OS_RELEASE" > "$PKGDEPLOYDIR/etc/$fname"
|
||||
echo "file etc/$fname 0644 0 0" >> "$PKGDEPLOYDIR/${PKGNAME}.files"
|
||||
|
||||
# local config files
|
||||
fname=$(file_path_override "resolv.conf")
|
||||
|
||||
if [ ! -z "$fname" ]; then
|
||||
cp "$fname" "$PKGDEPLOYDIR/etc/resolv.conf"
|
||||
echo "file etc/resolv.conf 0644 0 0" \
|
||||
>> "$PKGDEPLOYDIR/${PKGNAME}.files"
|
||||
fi
|
||||
}
|
||||
|
||||
check_update() {
|
||||
return
|
||||
}
|
|
@ -1,62 +1,45 @@
|
|||
DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
|
||||
|
||||
build() {
|
||||
# setup skeleton
|
||||
mkdir -pv ${PKGBUILDDIR}/{bin,dev,sys,proc,tmp,run,boot,usr,mnt,share}
|
||||
mkdir -pv ${PKGBUILDDIR}/cfg/{preserve,overlay}
|
||||
mkdir -pv ${PKGBUILDDIR}/etc/{profile.d,skel}
|
||||
mkdir -pv ${PKGBUILDDIR}/var/lib
|
||||
mkdir -pv ${PKGBUILDDIR}/lib/libexec
|
||||
|
||||
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$PKGBUILDDIR"
|
||||
cp -r "$SCRIPTDIR/pkg/$PKGNAME/lib" "$PKGBUILDDIR"
|
||||
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
# version info
|
||||
local fname=$(echo "${OS_NAME}-release" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
echo $OS_RELEASE > $PKGBUILDDIR/etc/$fname
|
||||
|
||||
echo "etc/$fname m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
# local config files
|
||||
fname=$(file_path_override "resolv.conf")
|
||||
|
||||
if [ ! -z "$fname" ]; then
|
||||
cp "$fname" "./etc/resolv.conf"
|
||||
echo "etc/resolv.conf m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
||||
fi
|
||||
|
||||
# gather rootfs dependencies
|
||||
cat_file_merge "ROOTFS" | sort -u | \
|
||||
xargs pkg install -om -R "$REPODIR" -r "$PKGBUILDDIR"
|
||||
|
||||
cat_file_merge "ROOTFS" | sort -u | \
|
||||
xargs pkg install -R "$REPODIR" \
|
||||
-r "$PKGBUILDDIR" -F sqfs -l >> "$PKGDEPLOYDIR/pseudo"
|
||||
# generate pseudo file listing for squashfs
|
||||
pkg install -l -R "$REPODIR" -r "$TCDIR/$TARGET" \
|
||||
-F sqfs $DEPENDS | sort -u > "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
# setup root home directory
|
||||
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/usr/root"
|
||||
cp -r "$TCDIR/$TARGET/etc/skel" "$TCDIR/$TARGET/usr/root"
|
||||
|
||||
echo "usr/root m 700 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
find "./usr/root" -exec stat {} --printf="%n m %a 0 0\\n" \; | \
|
||||
sed 's#^./##g' | tail -n +2 >> "$PKGDEPLOYDIR/pseudo"
|
||||
find "$TCDIR/$TARGET/usr/root" \
|
||||
-exec stat {} --printf="%n m %a 0 0\\n" \; | \
|
||||
sed 's#^$TCDIR/$TARGET/##g' | tail -n +2 >> "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
# move configuration to preserve directory
|
||||
mv "$PKGBUILDDIR/etc" "$PKGBUILDDIR/cfg/preserve/etc"
|
||||
mv "$PKGBUILDDIR/usr" "$PKGBUILDDIR/cfg/preserve/usr"
|
||||
mv "$PKGBUILDDIR/var/lib" "$PKGBUILDDIR/cfg/preserve/var_lib"
|
||||
rm -rf "$PKGBUILDDIR/var"
|
||||
mkdir -pv "$TCDIR/$TARGET/cfg/preserve"
|
||||
mkdir -pv "$TCDIR/$TARGET/cfg/overlay"
|
||||
|
||||
mkdir -p ${PKGBUILDDIR}/{etc,var,usr}
|
||||
echo <<_EOF >> "$PKGDEPLOYDIR/pseudo"
|
||||
cfg m 755 0 0
|
||||
cfg/preserve m 755 0 0
|
||||
cfg/preserve/etc m 755 0 0
|
||||
cfg/preserve/usr m 755 0 0
|
||||
cfg/preserve/var_lib m 755 0 0
|
||||
cfg/overlay m 755 0 0
|
||||
_EOF
|
||||
|
||||
mv "$TCDIR/$TARGET/etc" "$TCDIR/$TARGET/cfg/preserve/etc"
|
||||
mv "$TCDIR/$TARGET/usr" "$TCDIR/$TARGET/cfg/preserve/usr"
|
||||
mv "$TCDIR/$TARGET/var/lib" "$TCDIR/$TARGET/cfg/preserve/var_lib"
|
||||
rm -rf "$TCDIR/$TARGET/var"
|
||||
|
||||
mkdir -p $TCDIR/$TARGET/{etc,var,usr}
|
||||
|
||||
sed -i 's#etc/#cfg/preserve/etc/#g' "$PKGDEPLOYDIR/pseudo"
|
||||
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$PKGDEPLOYDIR/pseudo"
|
||||
sed -i 's#usr/#cfg/preserve/usr/#g' "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
# don't add stuff for the boot partition to the squashfs image
|
||||
mv ${PKGBUILDDIR}/boot/* "$PKGDEPLOYDIR"
|
||||
mv $TCDIR/$TARGET/boot/* "$PKGDEPLOYDIR"
|
||||
|
||||
grep -v "^boot/" "$PKGDEPLOYDIR/pseudo" > "$PKGDEPLOYDIR/pseudo.temp"
|
||||
mv "$PKGDEPLOYDIR/pseudo.temp" "$PKGDEPLOYDIR/pseudo"
|
||||
|
@ -64,7 +47,7 @@ build() {
|
|||
}
|
||||
|
||||
deploy() {
|
||||
mksquashfs "$PKGBUILDDIR" "$PKGDEPLOYDIR/rootfs.img" -comp xz \
|
||||
mksquashfs "$TCDIR/$TARGET" "$PKGDEPLOYDIR/rootfs.img" -comp xz \
|
||||
-no-progress -no-xattrs -pf "$PKGDEPLOYDIR/pseudo"
|
||||
|
||||
rm "$PKGDEPLOYDIR/pseudo"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/proc/self/mounts
|
|
@ -1,29 +0,0 @@
|
|||
bin m 555 0 0
|
||||
dev m 755 0 0
|
||||
sys m 755 0 0
|
||||
proc m 755 0 0
|
||||
tmp m 1777 0 0
|
||||
run m 755 0 0
|
||||
boot m 755 0 0
|
||||
usr m 755 0 0
|
||||
mnt m 755 0 0
|
||||
share m 555 0 0
|
||||
cfg m 755 0 0
|
||||
cfg/preserve m 755 0 0
|
||||
cfg/preserve/etc m 755 0 0
|
||||
cfg/preserve/usr m 755 0 0
|
||||
cfg/preserve/var_lib m 755 0 0
|
||||
cfg/overlay m 755 0 0
|
||||
etc m 755 0 0
|
||||
etc/profile.d m 755 0 0
|
||||
etc/skel m 755 0 0
|
||||
etc/group m 644 0 0
|
||||
etc/hosts m 644 0 0
|
||||
etc/passwd m 644 0 0
|
||||
etc/hostname m 644 0 0
|
||||
etc/shadow m 600 0 0
|
||||
etc/mtab m 777 0 0
|
||||
var m 755 0 0
|
||||
lib m 555 0 0
|
||||
lib/libexec m 555 0 0
|
||||
lib/charset.alias m 444 0 0
|
|
@ -1,4 +1,4 @@
|
|||
DEPENDS="tc-binutils crt-dev tc-pkg-config tc-file tc-pkgtool"
|
||||
DEPENDS="tc-binutils crt-dev tc-pkg-config tc-file tc-pkgtool basefiles"
|
||||
|
||||
build() {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue