Major refactoring

This commit is contained in:
Fierelier 2022-08-04 22:56:02 +02:00
parent 5692fbe881
commit 1fa7d1329d
59 changed files with 142 additions and 101 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
output/ chroots/

99
make-os
View File

@ -1,54 +1,71 @@
#!/usr/bin/env bash #!/bin/bash
set -e set -e
if cd "$(dirname "$(realpath -s "$BASH_SOURCE")")"
if [ "$1" = "" ]; then source shell
echo "Define i386/amd64 as the first argument." source "env-$1"
exit 1
fi (
cd "$(dirname "$(realpath -s "$BASH_SOURCE")")" set -e
source shell # export OPUS_OUTPUT="/media/zram"
source "env-$1" export OPUS_IMAGEDIR_BASE="$OPUS_OUTPUT/$1/base"
#export OPUS_IMAGEDIR="/media/zram/$1" export OPUS_IMAGEDIR_FINAL="$OPUS_OUTPUT/$1/final"
export OPUS_IMAGEDIR="$OPUS_OUTPUT/$1"
make-base "$OPUS_IMAGEDIR" # Base image
export OPUS_PACKAGES="" export OPUS_PACKAGES=""
export OPUS_PACKAGES_INTERACTIVE=""
export OPUS_PACKAGES_DL="" export OPUS_PACKAGES_DL=""
export OPUS_PACKAGES_REMOVE="" export OPUS_PACKAGES_REMOVE=""
# Base # Base
source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR" if [ -d "$OPUS_IMAGEDIR_BASE-tmp" ]; then
source apply-mod "$OPUS_HOME/input/oobe" "$OPUS_IMAGEDIR" rm -f -r "$OPUS_IMAGEDIR_BASE-tmp"
fi
# Base - Hardware if ! [ -d "$OPUS_IMAGEDIR_BASE" ]; then
source apply-mod "$OPUS_HOME/input/kernel" "$OPUS_IMAGEDIR" mkdir -p "$OPUS_IMAGEDIR_BASE-tmp"
source apply-mod "$OPUS_HOME/input/firmware-free" "$OPUS_IMAGEDIR" make-base "$OPUS_IMAGEDIR_BASE-tmp" # Base image
source apply-mod "$OPUS_HOME/input/grub" "$OPUS_IMAGEDIR" source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR_BASE-tmp"
mv "$OPUS_IMAGEDIR_BASE-tmp" "$OPUS_IMAGEDIR_BASE"
fi
# Graphical if [ -d "$OPUS_IMAGEDIR_FINAL-tmp" ]; then
source apply-mod "$OPUS_HOME/input/packages-graphical" "$OPUS_IMAGEDIR" rm -f -r "$OPUS_IMAGEDIR_FINAL-tmp"
fi
# Overrides if ! [ -d "$OPUS_IMAGEDIR_FINAL" ]; then
source apply-mod "$OPUS_HOME/input/hostname" "$OPUS_IMAGEDIR" echo "Copying base image ..."
source apply-mod "$OPUS_HOME/input/user-config" "$OPUS_IMAGEDIR" cp -a "$OPUS_IMAGEDIR_BASE" "$OPUS_IMAGEDIR_FINAL-tmp"
# Hardware
source apply-mod "$OPUS_HOME/mods/kernel" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-free" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/grub" "$OPUS_IMAGEDIR_FINAL-tmp"
# Graphical
source apply-mod "$OPUS_HOME/mods/packages-graphical" "$OPUS_IMAGEDIR_FINAL-tmp"
# Overrides
source apply-mod "$OPUS_HOME/mods/hostname" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/user-config" "$OPUS_IMAGEDIR_FINAL-tmp"
# Raw image
# source apply-mod "$OPUS_HOME/input/image-raw" "$OPUS_IMAGEDIR"
# Packages
source apply-mod "$OPUS_HOME/mods/fast-dpkg" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/packages-apply" "$OPUS_IMAGEDIR_FINAL-tmp"
# Extra
source apply-mod "$OPUS_HOME/mods/oobe" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/clean-logs" "$OPUS_IMAGEDIR_FINAL-tmp"
mv "$OPUS_IMAGEDIR_FINAL-tmp" "$OPUS_IMAGEDIR_FINAL"
fi
# Raw image echo ""
source apply-mod "$OPUS_HOME/input/image-raw" "$OPUS_IMAGEDIR" echo "Done."
#make-image-gz "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").tar.gz" # tar.gz image
# Packages )
source apply-mod "$OPUS_HOME/input/fast-dpkg" "$OPUS_IMAGEDIR" if [ $? != 0 ]; then
source apply-mod "$OPUS_HOME/input/packages-apply" "$OPUS_IMAGEDIR"
# Extra
source apply-mod "$OPUS_HOME/input/clean-logs" "$OPUS_IMAGEDIR"
make-image "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img" # Disk image
then
set +e set +e
else echo "Script execution ended due to error. Cleaning up..."
set +e
echo
echo Script execution ended due to error. Cleaning up...
fchroot-end "$OPUS_IMAGEDIR" fchroot-end "$OPUS_IMAGEDIR"
rm -r "$OPUS_IMAGEDIR" echo "Script execution ended due to error."
echo Script execution ended due to error. exit 1
fi fi

View File

@ -1,56 +1,72 @@
#!/usr/bin/env bash #!/bin/bash
set -e set -e
if cd "$(dirname "$(realpath -s "$BASH_SOURCE")")"
if [ "$1" = "" ]; then source shell
echo "Define i386/amd64 as the first argument." source "env-$1"
exit 1
fi (
cd "$(dirname "$(realpath -s "$BASH_SOURCE")")" set -e
source shell # export OPUS_OUTPUT="/media/zram"
source "env-$1" export OPUS_IMAGEDIR_BASE="$OPUS_OUTPUT/$1/base"
source "env-proprietary" export OPUS_IMAGEDIR_FINAL="$OPUS_OUTPUT/$1/final"
#export OPUS_IMAGEDIR="/media/zram/$1"
export OPUS_IMAGEDIR="$OPUS_OUTPUT/$1"
make-base "$OPUS_IMAGEDIR" # Base image
export OPUS_PACKAGES="" export OPUS_PACKAGES=""
export OPUS_PACKAGES_INTERACTIVE=""
export OPUS_PACKAGES_DL="" export OPUS_PACKAGES_DL=""
export OPUS_PACKAGES_REMOVE="" export OPUS_PACKAGES_REMOVE=""
# Base # Base
source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR" if [ -d "$OPUS_IMAGEDIR_BASE-tmp" ]; then
source apply-mod "$OPUS_HOME/input/oobe" "$OPUS_IMAGEDIR" rm -f -r "$OPUS_IMAGEDIR_BASE-tmp"
fi
# Base - Hardware if ! [ -d "$OPUS_IMAGEDIR_BASE" ]; then
source apply-mod "$OPUS_HOME/input/kernel" "$OPUS_IMAGEDIR" mkdir -p "$OPUS_IMAGEDIR_BASE-tmp"
source apply-mod "$OPUS_HOME/input/firmware-free" "$OPUS_IMAGEDIR" make-base "$OPUS_IMAGEDIR_BASE-tmp" # Base image
source apply-mod "$OPUS_HOME/input/firmware-proprietary" "$OPUS_IMAGEDIR" source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR_BASE-tmp"
source apply-mod "$OPUS_HOME/input/grub" "$OPUS_IMAGEDIR" mv "$OPUS_IMAGEDIR_BASE-tmp" "$OPUS_IMAGEDIR_BASE"
fi
# Graphical if [ -d "$OPUS_IMAGEDIR_FINAL-tmp" ]; then
source apply-mod "$OPUS_HOME/input/packages-graphical" "$OPUS_IMAGEDIR" rm -f -r "$OPUS_IMAGEDIR_FINAL-tmp"
fi
# Overrides if ! [ -d "$OPUS_IMAGEDIR_FINAL" ]; then
source apply-mod "$OPUS_HOME/input/hostname" "$OPUS_IMAGEDIR" echo "Copying base image ..."
source apply-mod "$OPUS_HOME/input/user-config" "$OPUS_IMAGEDIR" cp -a "$OPUS_IMAGEDIR_BASE" "$OPUS_IMAGEDIR_FINAL-tmp"
# Hardware
source apply-mod "$OPUS_HOME/mods/kernel" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-free" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-proprietary" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/grub" "$OPUS_IMAGEDIR_FINAL-tmp"
# Graphical
source apply-mod "$OPUS_HOME/mods/packages-graphical" "$OPUS_IMAGEDIR_FINAL-tmp"
# Overrides
source apply-mod "$OPUS_HOME/mods/hostname" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/user-config" "$OPUS_IMAGEDIR_FINAL-tmp"
# Raw image
# source apply-mod "$OPUS_HOME/input/image-raw" "$OPUS_IMAGEDIR"
# Packages
source apply-mod "$OPUS_HOME/mods/fast-dpkg" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/packages-apply" "$OPUS_IMAGEDIR_FINAL-tmp"
# Extra
source apply-mod "$OPUS_HOME/mods/oobe" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/clean-logs" "$OPUS_IMAGEDIR_FINAL-tmp"
mv "$OPUS_IMAGEDIR_FINAL-tmp" "$OPUS_IMAGEDIR_FINAL"
fi
# Raw image echo ""
source apply-mod "$OPUS_HOME/input/image-raw" "$OPUS_IMAGEDIR" echo "Done."
#make-image-gz "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").tar.gz" # tar.gz image
# Packages )
source apply-mod "$OPUS_HOME/input/fast-dpkg" "$OPUS_IMAGEDIR" if [ $? != 0 ]; then
source apply-mod "$OPUS_HOME/input/packages-apply" "$OPUS_IMAGEDIR"
# Extra
source apply-mod "$OPUS_HOME/input/clean-logs" "$OPUS_IMAGEDIR"
make-image "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img" # Disk image
then
set +e set +e
else echo "Script execution ended due to error. Cleaning up..."
set +e
echo
echo Script execution ended due to error. Cleaning up...
fchroot-end "$OPUS_IMAGEDIR" fchroot-end "$OPUS_IMAGEDIR"
rm -r "$OPUS_IMAGEDIR" echo "Script execution ended due to error."
echo Script execution ended due to error. exit 1
fi fi

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
find "$1/var/log" -type f -delete find "$1/var/log" -type f -delete

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux-free firmware-ath9k-htc" export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux-free firmware-ath9k-htc"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
function sfp { function sfp {
packages="" packages=""
while read p; do while read p; do
@ -7,6 +7,7 @@ function sfp {
packages="$packages ${packageinfo[0]}" packages="$packages ${packageinfo[0]}"
fi fi
done <<<$(apt-cache search "$1") done <<<$(apt-cache search "$1")
echo $packages echo "${packages//"firmware-ipw2x00"/""}"
} }
export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux firmware-misc-nonfree $(sfp wireless) $(sfp wifi) $(sfp net)" export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux firmware-misc-nonfree $(sfp wireless) $(sfp wifi) $(sfp net)"
export OPUS_PACKAGES_INTERACTIVE="$OPUS_PACKAGES_INTERACTIVE firmware-ipw2x00"

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES grub2" export OPUS_PACKAGES="$OPUS_PACKAGES grub2"

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
echo $(head -c4 </dev/urandom|xxd -p -u) >"$1/etc/hostname" echo $(head -c4 </dev/urandom|xxd -p -u) >"$1/etc/hostname"

View File

@ -1,3 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
set -e
export OPUS_PACKAGES="$OPUS_PACKAGES cloud-utils" export OPUS_PACKAGES="$OPUS_PACKAGES cloud-utils"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES sudo keyboard-configuration network-manager python3 cloud-utils ecryptfs-utils rsync lsof" export OPUS_PACKAGES="$OPUS_PACKAGES sudo keyboard-configuration network-manager python3 cloud-utils ecryptfs-utils rsync lsof"
export OPUS_PACKAGES_DL="$OPUS_PACKAGES console-setup locales tzdata" export OPUS_PACKAGES_DL="$OPUS_PACKAGES console-setup locales tzdata"

View File

@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/bin/bash
apt -y update apt -y update
apt -y upgrade apt -y upgrade
DEBIAN_FRONTEND="noninteractive"
apt -y install $OPUS_PACKAGES apt -y install $OPUS_PACKAGES
apt -y install --download-only $OPUS_PACKAGES_DL apt -y install --download-only $OPUS_PACKAGES_DL
unset DEBIAN_FRONTEND
apt -y install $OPUS_PACKAGES_INTERACTIVE
apt -y remove $OPUS_PACKAGES_REMOVE apt -y remove $OPUS_PACKAGES_REMOVE
apt -y autoclean apt -y autoclean

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES xorg xfce4 xfce4-*-plugin xfce4-power-manager gvfs gvfs-backends gvfs-fuse network-manager-gnome xfce4-terminal xfce4-screenshooter mousepad netsurf-gtk xautolock xsecurelock qt5-style-plugins alsa-utils synaptic epiphany-browser" export OPUS_PACKAGES="$OPUS_PACKAGES xorg xfce4 xfce4-*-plugin xfce4-power-manager gvfs gvfs-backends gvfs-fuse network-manager-gnome xfce4-terminal xfce4-screenshooter mousepad netsurf-gtk xautolock xsecurelock qt5-style-plugins alsa-utils synaptic epiphany-browser"
export OPUS_PACKAGES_REMOVE="$OPUS_PACKAGES_REMOVE xscreensaver" export OPUS_PACKAGES_REMOVE="$OPUS_PACKAGES_REMOVE xscreensaver"

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/bin/bash
echo "$OPUS_SOURCES" >"$1/etc/apt/sources.list" echo "$OPUS_SOURCES" >"$1/etc/apt/sources.list"

View File

4
path/make-image-gz Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -e
cd "$OPUS_IMAGEDIR"
tar -czvf "$2"

7
shell
View File

@ -1,9 +1,11 @@
#!/usr/bin/env bash #!/bin/bash
set -e
alias cp="cp --reflink=auto"
export OPUS_NAME="opus-dvn" export OPUS_NAME="opus-dvn"
export OPUS_HOME="$(dirname "$(realpath -s "$BASH_SOURCE")")" export OPUS_HOME="$(dirname "$(realpath -s "$BASH_SOURCE")")"
export PATH="$OPUS_HOME/path:$PATH" export PATH="$OPUS_HOME/path:$PATH"
export OPUS_PID="$BASHPID" export OPUS_PID="$BASHPID"
export OPUS_OUTPUT="$OPUS_HOME/output" export OPUS_OUTPUT="$OPUS_HOME/chroots"
export OPUS_URL="http://deb.devuan.org/merged" export OPUS_URL="http://deb.devuan.org/merged"
export OPUS_DIST="chimaera" export OPUS_DIST="chimaera"
export OPUS_SOURCES="deb http://deb.devuan.org/merged $OPUS_DIST main export OPUS_SOURCES="deb http://deb.devuan.org/merged $OPUS_DIST main
@ -17,7 +19,6 @@ deb http://pkgmaster.devuan.org/merged $OPUS_DIST-security main
# deb http://deb.devuan.org/merged $OPUS_DIST-updates main # deb http://deb.devuan.org/merged $OPUS_DIST-updates main
# deb-src http://deb.devuan.org/merged $OPUS_DIST-updates main # deb-src http://deb.devuan.org/merged $OPUS_DIST-updates main
" "
#export DEBIAN_FRONTEND="noninteractive"
export PS1="\[\033[0;35m\]\$OPUS_NAME \$OPUS_ARCH \[\033[0m\]- \[\033[0;37m\]\$PWD\[\033[0m\]: " export PS1="\[\033[0;35m\]\$OPUS_NAME \$OPUS_ARCH \[\033[0m\]- \[\033[0;37m\]\$PWD\[\033[0m\]: "
env env
echo "" echo ""