1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:47:46 +00:00

Meta: Make sure files are installed with the right UID and GID

Unfortunately we can't just use --chown everywhere because only rsync
version 3.1 and newer support it and the default rsync on macOS is
2.6.9.

Fixes #8711.
This commit is contained in:
Gunnar Beutner 2021-07-13 07:48:21 +02:00 committed by Andreas Kling
parent 7347c20fe6
commit 77795b2c8f

View file

@ -33,12 +33,19 @@ umask 0022
printf "installing base system... " printf "installing base system... "
if command -v rsync >/dev/null; then if command -v rsync >/dev/null; then
if rsync --chown 2>&1 | grep "missing argument" >/dev/null; then
rsync -aH --chown=0:0 --inplace "$SERENITY_SOURCE_DIR"/Base/ mnt/
rsync -aH --chown=0:0 --inplace Root/ mnt/
else
rsync -aH --inplace "$SERENITY_SOURCE_DIR"/Base/ mnt/ rsync -aH --inplace "$SERENITY_SOURCE_DIR"/Base/ mnt/
rsync -aH --inplace Root/ mnt/ rsync -aH --inplace Root/ mnt/
chown -R 0:0 mnt/
fi
else else
echo "Please install rsync to speed up image creation times, falling back to cp for now" echo "Please install rsync to speed up image creation times, falling back to cp for now"
$CP -PdR "$SERENITY_SOURCE_DIR"/Base/* mnt/ $CP -PdR "$SERENITY_SOURCE_DIR"/Base/* mnt/
$CP -PdR Root/* mnt/ $CP -PdR Root/* mnt/
chown -R 0:0 mnt/
fi fi
SERENITY_ARCH="${SERENITY_ARCH:-i686}" SERENITY_ARCH="${SERENITY_ARCH:-i686}"
$CP "$SERENITY_SOURCE_DIR"/Toolchain/Local/"$SERENITY_ARCH"/"$SERENITY_ARCH"-pc-serenity/lib/libgcc_s.so mnt/usr/lib/ $CP "$SERENITY_SOURCE_DIR"/Toolchain/Local/"$SERENITY_ARCH"/"$SERENITY_ARCH"-pc-serenity/lib/libgcc_s.so mnt/usr/lib/
@ -88,8 +95,6 @@ if [ -f mnt/bin/utmpupdate ]; then
chmod 2755 mnt/bin/utmpupdate chmod 2755 mnt/bin/utmpupdate
fi fi
chown 0:0 mnt/boot/Kernel
chown 0:0 mnt/res/kernel.map
chmod 0400 mnt/res/kernel.map chmod 0400 mnt/res/kernel.map
chmod 0400 mnt/boot/Kernel chmod 0400 mnt/boot/Kernel
chmod 600 mnt/etc/shadow chmod 600 mnt/etc/shadow
@ -142,7 +147,6 @@ cp -r "$SERENITY_SOURCE_DIR"/Userland/Libraries/LibJS/Tests/test-common.js mnt/h
chmod 700 mnt/root chmod 700 mnt/root
chmod 700 mnt/home/anon chmod 700 mnt/home/anon
chmod 700 mnt/home/nona chmod 700 mnt/home/nona
chown -R 0:0 mnt/root
chown -R 100:100 mnt/home/anon chown -R 100:100 mnt/home/anon
chown -R 200:200 mnt/home/nona chown -R 200:200 mnt/home/nona
echo "done" echo "done"