Compare commits

..

No commits in common. "main" and "dev" have entirely different histories.
main ... dev

6 changed files with 13 additions and 34 deletions

1
.gitignore vendored
View file

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

3
.gitmodules vendored
View file

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

View file

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

View file

@ -16,21 +16,19 @@ fetch_base_system()
local release="$2" local release="$2"
local releasever="$3" local releasever="$3"
local edition="$4" local edition="$4"
local variant="$5"
[ ! -d "$rootdir" ] && { [ ! -d "$rootdir" ] && {
log "Rootdir [$rootdir] does not exists" ierror log "Rootdir [$rootdir] does not exists" ierror
return 2 return 2
} }
local xz_url="https://fedora.mirrorservice.org/fedora/linux/releases/$release/$edition/aarch64/images/Fedora-$variant-$release-$releasever.aarch64.raw.xz" local xz_url="https://fedora.mirrorservice.org/fedora/linux/releases/$release/$edition/aarch64/images/Fedora-$edition-$release-$releasever.aarch64.raw.xz"
local xz_path="./cache/Fedora-$edition-$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" local raw_path="./cache/Fedora-$edition-$release-$releasever.aarch64.raw"
[ ! -f "$xz_path" ] && { [ ! -f "$xz_path" ] && {
log "Downloading generic rootfs from $xz_url" internal log "Downloading generic rootfs" internal
wget -q --show-progress -O "$xz_path" "$xz_url" || { wget -q --show-progress -O "$xz_path" "$xz_url" || {
log "Failed to download generic rootfs" ierror log "Failed to download generic rootfs" ierror
[ -f "$xz_path" ] && rm "$xz_path"
return 1 return 1
} }
} }
@ -55,13 +53,13 @@ fetch_base_system()
return 1 return 1
} }
log "rSyncing system" internal log "rSyncing system"
rsync -a --info=progress2 --info=name0 "$raw_mnt/root/"* "$rootdir/" || { rsync -a --info=progress2 --info=name0 "$raw_mnt/root/"* "$rootdir/" || {
log "Failed to rsync system" ierror log "Failed to rsync system" ierror
return 1 return 1
} }
log "Unmounting generic rootfs" internal log "Unmounting generic rootfs"
{ {
umount "$raw_mnt" && umount "$raw_mnt" &&
rm -d "$raw_mnt" && rm -d "$raw_mnt" &&
@ -83,7 +81,7 @@ prepare_system()
log "Removing generic kernel and firmware" internal log "Removing generic kernel and firmware" internal
rm -rf "$rootdir/usr/lib/kernel/install.d/10-devicetree.instal" rm -rf "$rootdir/usr/lib/kernel/install.d/10-devicetree.instal"
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" || { 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" || {
log "Failed to remove generic kernel and firmware" ierror log "Failed to remove generic kernel and firmware" ierror
return 1 return 1
} }

View file

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

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