a radical and experimental distribution based on musl libc and busybox http://sabo.xyz
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

# use: setup-rootfs.sh [no args, uses $H/config]
# used for cross-compilation
# this prepares a chroot-like directory containing the root file system
export H="$PWD"
[ -z "$CONFIG" ] && CONFIG=./config
if [ -z "$R" ]; then
printf -- "ERROR: invalid or no config file\n"
exit 1
if [ ! -d "$K" ] || [ ! -d $S/pkg ] ; then
test "$STAGE" != 0 && {
printf -- 'ERROR: configured paths for $S/pkg or $K do not exist\n'
printf -- 'you configured %s for $K and %s for $S\n' "$K" "$S"
printf -- '(fix your config and let S point to your sabotage checkout)\n'
exit 1
# enable verbose printing, abort on error
set -e
mkdir -p "$K" "$C" "$S" "$R" "$LOGPATH"
cd "$R"
mkdir -p boot bin dev etc home lib mnt proc root share srv src sys tmp var
mkdir -p src/logs src/build src/tarballs src/pkg src/KEEP
mkdir -p var/log/sshd var/log/crond var/log/dmesg
mkdir -p var/empty var/service var/lib var/run var/spool/cron/crontabs
# usr and sbin are a mistake
ln -sfn . usr
ln -sfn bin sbin
ln -sfn ../tmp var/tmp
chmod 775 src/build
chmod 1777 tmp
chmod 700 root
cp -r "$K"/etc/* "$R"/etc/
cp -r "$K"/boot/* "$R"/boot/
chmod 0600 "$R"/etc/shadow