Files
filesystem/source.sh
T
2026-04-16 16:48:39 +03:00

68 lines
3.0 KiB
Bash

# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
install -dm755 "$BPM_OUTPUT"/etc
install -dm755 "$BPM_OUTPUT"/var
install -dm755 "$BPM_OUTPUT"/usr
install -dm755 "$BPM_OUTPUT"/dev
install -dm755 "$BPM_OUTPUT"/proc
install -dm755 "$BPM_OUTPUT"/sys
install -dm755 "$BPM_OUTPUT"/run
install -dm755 "$BPM_OUTPUT"/boot
install -dm755 "$BPM_OUTPUT"/opt
install -dm755 "$BPM_OUTPUT"/srv
install -dm755 "$BPM_OUTPUT"/mnt
install -dm755 "$BPM_OUTPUT"/home
install -dm755 "$BPM_OUTPUT"/usr/lib/firmware
install -dm755 "$BPM_OUTPUT"/usr/{,local/}{include,src}
install -dm755 "$BPM_OUTPUT"/usr/{,local/}{bin,lib,sbin}
install -dm755 "$BPM_OUTPUT"/lib64
install -dm755 "$BPM_OUTPUT"/usr/{,local/}share/{color,dict,doc,info,locale,man}
install -dm755 "$BPM_OUTPUT"/usr/{,local/}share/{misc,terminfo,zoneinfo}
install -dm755 "$BPM_OUTPUT"/usr/{,local/}share/man/man{1..8}
install -dm755 "$BPM_OUTPUT"/var/{cache,local,log,mail,opt,spool}
install -dm755 "$BPM_OUTPUT"/var/lib/{color,misc,locate}
install -dm750 "$BPM_OUTPUT"/root
install -dm1777 "$BPM_OUTPUT"/tmp
install -dm1777 "$BPM_OUTPUT"/var/tmp
install -dm1777 "$BPM_OUTPUT"/var/mail
install -dm755 "$BPM_OUTPUT"/etc/sysctl.d
ln -s usr/bin "$BPM_OUTPUT"/bin
ln -s usr/sbin "$BPM_OUTPUT"/sbin
ln -s usr/lib "$BPM_OUTPUT"/lib
ln -s /proc/self/mounts "$BPM_OUTPUT"/etc/mtab
ln -s /run "$BPM_OUTPUT"/var/run
ln -s /run/lock "$BPM_OUTPUT"/var/lock
ln -s ../mail "$BPM_OUTPUT"/var/spool/mail
ln -s bash "$BPM_OUTPUT"/bin/sh
touch "$BPM_OUTPUT"/var/log/{btmp,lastlog,faillog,wtmp}
chgrp utmp "$BPM_OUTPUT"/var/log/lastlog
chmod 664 "$BPM_OUTPUT"/var/log/lastlog
chmod 600 "$BPM_OUTPUT"/var/log/btmp
install -Dm644 "$BPM_WORKDIR"/hosts "$BPM_OUTPUT"/etc/hosts
install -Dm644 "$BPM_WORKDIR"/group "$BPM_OUTPUT"/etc/group
install -Dm644 "$BPM_WORKDIR"/passwd "$BPM_OUTPUT"/etc/passwd
install -Dm400 "$BPM_WORKDIR"/gshadow "$BPM_OUTPUT"/etc/gshadow
install -Dm400 "$BPM_WORKDIR"/shadow "$BPM_OUTPUT"/etc/shadow
install -Dm644 "$BPM_WORKDIR"/nsswitch.conf "$BPM_OUTPUT"/etc/nsswitch.conf
install -Dm644 "$BPM_WORKDIR"/os-release "$BPM_OUTPUT"/etc/os-release
install -Dm644 "$BPM_WORKDIR"/lsb-release "$BPM_OUTPUT"/etc/lsb-release
install -Dm644 "$BPM_WORKDIR"/shells "$BPM_OUTPUT"/etc/shells
install -Dm644 "$BPM_WORKDIR"/sysctl.conf "$BPM_OUTPUT"/usr/lib/sysctl.d/10-tidelinux.conf
install -Dm644 "$BPM_WORKDIR"/tidelinux-logo{,-full}.png -t "$BPM_OUTPUT"/usr/share/pixmaps/
touch "$BPM_OUTPUT"/etc/subuid
touch "$BPM_OUTPUT"/etc/subgid
echo "tidelinux" > "$BPM_OUTPUT"/etc/hostname
}