1
0

Filesystem Hierarchy Standard

This commit is contained in:
dtb 2022-01-25 10:56:40 -05:00
parent 93bb2e8ab6
commit 752110b0df
5 changed files with 103 additions and 7 deletions

2
lsd/dist/config.sh vendored
View File

@ -1,3 +1,5 @@
#!/bin/false #!/bin/false
GCC_UPSTREAM="git://gcc.gnu.org/git/gcc.git"
MUSL_UPSTREAM="git://git.musl-libc.org/musl" MUSL_UPSTREAM="git://git.musl-libc.org/musl"
PKGSRC_UPSTREAM="https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.xz"

85
lsd/dist/fhs vendored Normal file
View File

@ -0,0 +1,85 @@
#!/bin/false
# Filesystem Hierarchy Standard 3.0, 2015
# https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf
# section 3.2
mkdir -p "$PREFIX/bin"
mkdir -p "$PREFIX/boot"
mkdir -p "$PREFIX/dev"
mkdir -p "$PREFIX/etc"
mkdir -p "$PREFIX/lib"
mkdir -p "$PREFIX/media"
mkdir -p "$PREFIX/mnt"
mkdir -p "$PREFIX/opt"
mkdir -p "$PREFIX/run"
mkdir -p "$PREFIX/sbin"
mkdir -p "$PREFIX/srv"
mkdir -p "$PREFIX/tmp"
mkdir -p "$PREFIX/usr"
mkdir -p "$PREFIX/var"
# section 3.7.4
mkdir -p "$PREFIX/etc/opt"
# section 4.2
mkdir -p "$PREFIX/usr/bin"
mkdir -p "$PREFIX/usr/lib"
mkdir -p "$PREFIX/usr/local"
mkdir -p "$PREFIX/usr/sbin"
mkdir -p "$PREFIX/usr/share"
# section 4.3
mkdir -p "$PREFIX/usr/include"
ln -s "$PREFIX/usr/spool" "$PREFIX/var/spool"
ln -s "$PREFIX/usr/tmp" "$PREFIX/var/tmp"
ln -s "$PREFIX/usr/spool/locks" "$PREFIX/var/lock"
# section 4.6
mkdir -p "$PREFIX/usr/lib"
# section 4.9
mkdir -p "$PREFIX/usr/local"
# section 4.9.2
mkdir -p "$PREFIX/usr/local/bin"
#mkdir -p "$PREFIX/usr/local/etc" # see section 4.9.3
mkdir -p "$PREFIX/usr/local/games"
mkdir -p "$PREFIX/usr/local/include"
mkdir -p "$PREFIX/usr/local/lib"
mkdir -p "$PREFIX/usr/local/man"
mkdir -p "$PREFIX/usr/local/sbin"
mkdir -p "$PREFIX/usr/local/share"
mkdir -p "$PREFIX/usr/local/src"
# section 4.9.3
ln -s "$PREFIX/usr/local/etc" "$PREFIX/etc/local"
# section 4.11.6
mkdir -p "$PREFIX/usr/share/man"
# section 4.11.7
mkdir -p "$PREFIX/usr/share/misc"
# section 4.12
mkdir -p "$PREFIX/usr/src"
# section 5.2
mkdir -p "$PREFIX/var/cache"
mkdir -p "$PREFIX/var/lib"
mkdir -p "$PREFIX/var/local"
mkdir -p "$PREFIX/var/lock"
mkdir -p "$PREFIX/var/log"
mkdir -p "$PREFIX/var/opt"
#mkdir -p "$PREFIX/var/run" # see section 5.13.2
mkdir -p "$PREFIX/var/spool"
mkdir -p "$PREFIX/var/tmp"
# section 5.8.2
mkdir -p "$PREFIX/var/lib/misc"
# section 5.13.2
ln -s "$PREFIX/var/run" "$PREFIX/run"
# section 6.1.10
mkdir -p "$PREFIX/var/spool/cron"

12
lsd/dist/install vendored
View File

@ -9,4 +9,14 @@ For example, "PREFIX=/ %s".\n' "$0" 1>&2
exit 1 exit 1
fi fi
. ./sync_musl . "$PREFIX/dist/unrepo"
. "$PREFIX/dist/fhs"
. "$PREFIX/dist/sync_musl"
cd "$PREFIX/usr/src"
if [ -d gcc ]; then
cd gcc
git pull
else
fetch_upstream "$GCC_UPSTREAM"
fi

5
lsd/dist/sync_musl vendored
View File

@ -5,13 +5,12 @@ depend_on cd
depend_on make depend_on make
depend_on mkdir depend_on mkdir
mkdir -p "$PREFIX/src" cd "$PREFIX/usr/src"
cd "$PREFIX/src"
if [ -d musl ] if [ -d musl ]
then cd musl; git pull then cd musl; git pull
else fetch_upstream "$MUSL_UPSTREAM"; fi else fetch_upstream "$MUSL_UPSTREAM"; fi
cd "$PREFIX/src/musl" cd "$PREFIX/usr/src/musl"
./configure --prefix="$PREFIX" ./configure --prefix="$PREFIX"
make install make install

6
lsd/dist/try vendored
View File

@ -6,6 +6,6 @@ For example, "PREFIX=/ %s".\n' "$0" 1>&2
exit 1 exit 1
fi fi
cd "$PREFIX"/dist . "$PREFIX/dist/config.sh"
. ./macro.sh . "$PREFIX/dist/macro.sh"
. ./"$1" . "$PREFIX/dist/$1"