Files
SimpleLinux/scripts/rootfs.sh
T
2025-04-01 18:17:21 +07:00

77 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
. ./scripts/busybox.sh
. ./scripts/uclibc.sh
. ./scripts/kernel.sh
. ./scripts/zlib.sh
. ./scripts/dropbear.sh
. ./scripts/sftp_server.sh
. ./scripts/curl.sh
. ./scripts/bash.sh
. ./scripts/git.sh
. ./scripts/gitea.sh
. ./scripts/libnl.sh
. ./scripts/iw.sh
. ./scripts/openssl.sh
. ./scripts/hostapd.sh
. ./scripts/dnsmasq.sh
. ./scripts/iptables.sh
. ./scripts/8821au_ko.sh
#----------- Building rootfs ----------------------
rootfs() {
printf "$UGREEN** Building rootfs\n$RESET"
rm -rv $rootfspath # &>> $fulllogfile
mkdir -pv $rootfspath # &>> $fulllogfile
cd $rootfspath
mkdir -pv $(cat $rootfsfile) # &>> $fulllogfile
ln -sv usr/lib lib # &>> $fulllogfile
ln -sv usr/lib lib32 # &>> $fulllogfile
ln -sv usr/bin bin # &>> $fulllogfile
ln -sv usr/bin sbin # &>> $fulllogfile
ln -sv var/run run
cd usr
ln -sv bin sbin # &>> $fulllogfile
ln -sv lib lib32 # &>> $fulllogfile
ln -sv bin libexec
cd ..
tar -xvf $root/downloads/20250110-1.tar.gz
cp -rv initscripts/* .
rm -rv initscripts
ln -sv /proc/mounts etc/mtab # &>> $fulllogfile
busybox_rootfs
cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin # &>> $fulllogfile
cd $rootfspath/usr/bin
for i in $(cat $root/busybox/busybox_list); do ln -sv busybox $i; done
cp -v $root/rootfs/init.in $rootfspath/init
kernel_headers
uclibc
kernel
kernel_modules
[ "$ZLIB_ENABLE" = "y" ] && zlib
[ "$OPENSSL_ENABLE" = "y" ] && openssl
[ "$DNSMASQ_ENABLE" = "y" ] && dnsmasq
[ "$DROPBEAR_ENABLE" = "y" ] && dropbear
[ "$SFTP_SERVER_ENABLE" = "y" ] && sftp_server
[ "$CURL_ENABLE" = "y" ] && curl
[ "$BASH_ENABLE" = "y" ] && bash
[ "$GIT_ENABLE" = "y" ] && git_build
[ "$GITEA_ENABLE" = "y" ] && gitea
[ "$LIBNL_ENABLE" = "y" ] && libnl
[ "$IW_ENABLE" = "y" ] && iw
[ "$HOSTAPD_ENABLE" = "y" ] && hostapd
[ "$IPTABLES_ENABLE" = "y" ] && iptables
[ "$KO8821AU_ENABLE" = "y" ] && ko8821au
chmod 640 $rootfspath/etc/shadow $rootfspath/etc/inittab
chmod 755 $rootfspath/etc/init.d/* $rootfspath/usr/share/udhcpc/default.script $rootfspath/init
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
check $? "Build rootfs"
} # rootfs
#--------------------------------------------------