Files
2025-08-16 22:51:03 +07:00

93 lines
2.9 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
. ./scripts/finit_init.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
[ "$ARCH" = "arm" ] && ln -sv usr/lib lib32 # &>> $fulllogfile
[ "$ARCH" = "arm64" ] && ln -sv usr/lib lib64
ln -sv usr/bin bin # &>> $fulllogfile
ln -sv usr/bin sbin # &>> $fulllogfile
ln -sv var/run run
cd usr
ln -sv bin sbin # &>> $fulllogfile
[ "$ARCH" = "arm" ] && ln -sv lib lib32 # &>> $fulllogfile
[ "$ARCH" = "arm64" ] && ln -sv lib lib64
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
cat <<EOF > $rootfspath/etc/os-release
NAME="$distro_name"
PRETTY_NAME="$distro_pretty_name"
ID="$distro_id"
BUILD_ID="$distro_build_id"
EOF
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
if [ "$FINIT_INIT_ENABLE" = "y" ]; then
finit_init
cp -rv $root/rootfs/overlay/* $rootfspath
rm $rootfspath/init
ln -sv usr/bin/finit $rootfspath/init
fi
[ "$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
#--------------------------------------------------