Compare commits

...

13 commits
dev ... main

6 changed files with 34 additions and 13 deletions

1
.gitignore vendored
View file

@ -3,4 +3,3 @@ cache/
raw/
out/
tmp/
packages/

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "packages"]
path = packages
url = https://git.timoxa0.su/timoxa0/linux-nabu-packages.git

View file

@ -109,7 +109,7 @@ install_packages()
return 2
}
chroot "$rootdir" apt install $packages -y || {
chroot "$rootdir" apt install --no-install-recommends $packages -y || {
log "Failed to install package(s)" ierror
return 1
}

View file

@ -16,19 +16,21 @@ fetch_base_system()
local release="$2"
local releasever="$3"
local edition="$4"
local variant="$5"
[ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror
return 2
}
local xz_url="https://fedora.mirrorservice.org/fedora/linux/releases/$release/$edition/aarch64/images/Fedora-$edition-$release-$releasever.aarch64.raw.xz"
local xz_url="https://fedora.mirrorservice.org/fedora/linux/releases/$release/$edition/aarch64/images/Fedora-$variant-$release-$releasever.aarch64.raw.xz"
local xz_path="./cache/Fedora-$edition-$release-$releasever.aarch64.raw.xz"
local raw_path="./cache/Fedora-$edition-$release-$releasever.aarch64.raw"
[ ! -f "$xz_path" ] && {
log "Downloading generic rootfs" internal
log "Downloading generic rootfs from $xz_url" internal
wget -q --show-progress -O "$xz_path" "$xz_url" || {
log "Failed to download generic rootfs" ierror
[ -f "$xz_path" ] && rm "$xz_path"
return 1
}
}
@ -53,13 +55,13 @@ fetch_base_system()
return 1
}
log "rSyncing system"
log "rSyncing system" internal
rsync -a --info=progress2 --info=name0 "$raw_mnt/root/"* "$rootdir/" || {
log "Failed to rsync system" ierror
return 1
}
log "Unmounting generic rootfs"
log "Unmounting generic rootfs" internal
{
umount "$raw_mnt" &&
rm -d "$raw_mnt" &&
@ -81,7 +83,7 @@ prepare_system()
log "Removing generic kernel and firmware" internal
rm -rf "$rootdir/usr/lib/kernel/install.d/10-devicetree.instal"
chroot "$rootdir" /usr/bin/bash -c "rpm --noscripts -e gnome-initial-setup qcom-firmware atheros-firmware brcmfmac-firmware amd-ucode-firmware kernel-core nvidia-gpu-firmware kernel kernel-modules kernel-modules-core intel-audio-firmware cirrus-audio-firmware nvidia-gpu-firmware linux-firmware linux-firmware-whence intel-gpu-firmware amd-gpu-firmware libertas-firmware mt7xxx-firmware nxpwireless-firmware realtek-firmware tiwilink-firmware" || {
chroot "$rootdir" /usr/bin/bash -c "rpm --noscripts -e qcom-firmware atheros-firmware brcmfmac-firmware amd-ucode-firmware kernel-core nvidia-gpu-firmware kernel kernel-modules kernel-modules-core intel-audio-firmware cirrus-audio-firmware nvidia-gpu-firmware linux-firmware linux-firmware-whence intel-gpu-firmware amd-gpu-firmware libertas-firmware mt7xxx-firmware nxpwireless-firmware realtek-firmware tiwilink-firmware" || {
log "Failed to remove generic kernel and firmware" ierror
return 1
}

View file

@ -25,9 +25,9 @@ mkdir_if_not_exists ()
umount_if_mouted()
{
[ ! -d "$1" ] && return 0
[ ! -d "$1" ] && return 1
if grep -qs "$(realpath "$1")" /proc/mounts; then
umount "$1"
umount -R "$1"
return $?
else
return 0
@ -36,9 +36,9 @@ umount_if_mouted()
umount_force()
{
[ ! -d "$1" ] && return 0
while true; do
umount_if_mouted "$1" && break
[ ! -d "$1" ] && return 1
for run in {1..5}; do
umount -R "$1" && break
log "Failed to umount $1. Trying again after 3 seconds" ierror
sleep 3
done
@ -51,7 +51,7 @@ prepare_env()
mkdir_if_not_exists "./raw"
mkdir_if_not_exists "./tmp"
[ ! -d "./packages" ] && {
log "Packages not found. Cannot continue"
log "Packages not found. Cannot continue" error
exit 4
}
}
@ -82,6 +82,10 @@ arguments() {
cleanraw
exit $? ;;
-w | --cleancache)
cleancache
exit $? ;;
-h | -help | --help)
usage
exit $? ;;
@ -107,6 +111,9 @@ usage() {
# Clean raw images
$0 --cleanraw or -r
# Clean cache
$0 --cleancache or -w
# Build LNIBUILD
$0 <path/to/LNIBUILD>
EOF
@ -142,6 +149,15 @@ cleanraw()
rm ./raw/* -f && log "Done!"
}
cleancache()
{
find ./cache/ -mindepth 1 -maxdepth 1 | read || {
[ -z ${quiet+x} ] && log "Nothing to clean" error
return 0
}
rm ./cache/* -f && log "Done!"
}
# shellcheck disable=SC2317
_shutdown()
{

1
packages Submodule

@ -0,0 +1 @@
Subproject commit c06ebc8dc1e2f5c4bbb7f8552740cbf1624dff20