From b769253c53a5692c9d6b76c777680eb8013474fa Mon Sep 17 00:00:00 2001 From: teldra Date: Mon, 7 Feb 2022 05:35:12 +0100 Subject: [PATCH] progress --- {recipes => etc}/bootloader/grub | 0 etc/{de => profile}/gnome | 0 etc/{de => profile}/plasma | 1 + etc/{ => xserver}/x11 | 0 main.sh | 122 +++++++++++++++++++++++++------ 5 files changed, 100 insertions(+), 23 deletions(-) rename {recipes => etc}/bootloader/grub (100%) rename etc/{de => profile}/gnome (100%) rename etc/{de => profile}/plasma (91%) rename etc/{ => xserver}/x11 (100%) diff --git a/recipes/bootloader/grub b/etc/bootloader/grub similarity index 100% rename from recipes/bootloader/grub rename to etc/bootloader/grub diff --git a/etc/de/gnome b/etc/profile/gnome similarity index 100% rename from etc/de/gnome rename to etc/profile/gnome diff --git a/etc/de/plasma b/etc/profile/plasma similarity index 91% rename from etc/de/plasma rename to etc/profile/plasma index 526e613..e76becd 100644 --- a/etc/de/plasma +++ b/etc/profile/plasma @@ -1,5 +1,6 @@ packages() { addpkg "sddm" "kde5" "konsole" + need_xserver=1 } config() { diff --git a/etc/x11 b/etc/xserver/x11 similarity index 100% rename from etc/x11 rename to etc/xserver/x11 diff --git a/main.sh b/main.sh index 15b54b5..c37261c 100644 --- a/main.sh +++ b/main.sh @@ -2,6 +2,7 @@ main="/tmp/vinstall" target="${main}/target" +tmp_target="${main}/tmp_target" pass="oem" if [ $DEBUG ]; then @@ -161,36 +162,87 @@ base() { . ./etc/base packages reset packages + cp ./etc/base $tmp_target } gfx() { - multiplechoice "amd" "nvidia" "intel" - GFX=$output - . ./etc/gfx/$GFX - packages - reset packages + for i in $(find ./etc/gfx/ -type f); do + gfx+=("$(basename $i)") + done + if [ "${#gfx[@]}" -gt "1" ]; then + multiplechoice "${gfx[@]}" + GFX=$output + elif [ "${#gfx[@]}" -eq "1" ]; then + GFX=${gfx[0]} + fi + if ! [ "${#gfx[@]}" -eq "0" ]; then + . ./etc/gfx/$GFX + packages + reset packages + cp ./etc/gfx/$GFX $tmp_target + fi } soundsystem() { - multiplechoice "pulseaudio" "pipewire" - SOUNDSYSTEM=$output - . ./etc/soundsystem/$SOUNDSYSTEM - packages - reset packages + for i in $(find ./etc/soundsystem/ -type f); do + soundsystem+=("$(basename $i)") + done + if [ "${#soundsystem[@]}" -gt "1" ]; then + multiplechoice "${soundsystem[@]}" + SOUNDSYSTEM=$output + elif [ "${#soundsystem[@]}" -eq "1" ]; then + SOUNDSYSTEM=${soundsystem[0]} + fi + if ! [ "${#soundsystem[@]}" -eq "0" ]; then + . ./etc/soundsystem/$SOUNDSYSTEM + packages + reset packages + cp ./etc/soundsystem/$SOUNDSYSTEM $tmp_target + fi } -de() { - multiplechoice "plasma" "gnome" "minimal" - DE=$output - if ! [ "$DE" == "minimal" ]; then - gfx - soundsystem - . ./etc/de/$DE +xserver() { + for i in $(find ./etc/xserver/ -type f); do + xserver+=("$(basename $i)") + done + if [ "${#xserver[@]}" -gt "1" ]; then + multiplechoice "${xserver[@]}" + XSERVER=$output + elif [ "${#xserver[@]}" -eq "1" ]; then + XSERVER=${xserver[0]} + fi + if ! [ "${#xserver[@]}" -eq "0" ]; then + . ./etc/xserver/$XSERVER packages reset packages - . ./etc/x11 + cp ./etc/xserver/$XSERVER $tmp_target + fi +} + +profile() { + for i in $(find ./etc/profile/ -type f); do + profile+=("$(basename $i)") + done + if [ "${#profile[@]}" -gt "1" ]; then + multiplechoice "${profile[@]}" + PROFILE=$output + elif [ "${#profile[@]}" -eq "1" ]; then + PROFILE=${profile[0]} + fi + if ! [ "${#profile[@]}" -eq "0" ]; then + . ./etc/profile/$PROFILE packages reset packages + cp ./etc/profile/$PROFILE $tmp_target + if [ "$need_xserver" == "1" ]; then + xserver + fi + if [ "$need_gfx" == "1" ]; then + gfx + fi + if [ "$need_sound" == "1" ]; then + soundsystem + fi fi } @@ -210,16 +262,40 @@ lang() { } bootloader() { - for i in $(find recipes/bootloader -type f); do - bl+=("$(basename $i)") + for i in $(find ./etc/bootloader/ -type f); do + bootloader+=("$(basename $i)") done - if [ "${#bl[@]}" -gt "1" ]; then - multiplechoice "${bl[@]}" + if [ "${#bootloader[@]}" -gt "1" ]; then + multiplechoice "${bootloader[@]}" + BOOTLOADER=$output + elif [ "${#bootloader[@]}" -eq "1" ]; then + BOOTLOADER=${bootloader[0]} fi + if ! [ "${#bootloader[@]}" -eq "0" ]; then + . ./etc/bootloader/$BOOTLOADER + packages + reset packages + cp ./etc/bootloader/$BOOTLOADER $tmp_target + fi + } network() { - multiplechoice "NetworkManager" "dhcpcd" "iwd" + for i in $(find ./etc/network/ -type f); do + network+=("$(basename $i)") + done + if [ "${#network[@]}" -gt "1" ]; then + multiplechoice "${network[@]}" + NETWORK=$output + elif [ "${#network[@]}" -eq "1" ]; then + NETWORK=${network[0]} + fi + if ! [ "${#network[@]}" -eq "0" ]; then + . ./etc/network/$NETWORK + packages + reset packages + cp ./etc/network/$NETWORK $tmp_target + fi } do_install() {