Changed unneeded 'elif' statements to simple individual 'if' statements
This commit is contained in:
44
debian.sh
44
debian.sh
@@ -31,7 +31,9 @@ EOF
|
||||
systemd-timesyncd \
|
||||
whois \
|
||||
zfsutils-linux
|
||||
elif [[ "${1}" == '--mmdebstrap' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--mmdebstrap' ]]; then
|
||||
packages=(\
|
||||
console-setup \
|
||||
cryptsetup \
|
||||
@@ -71,7 +73,9 @@ zstd\
|
||||
${include} \
|
||||
"${VERSION_CODENAME}" \
|
||||
/mnt
|
||||
elif [[ "${1}" == '--network-interfaces' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--network-interfaces' ]]; then
|
||||
networkInterface=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
|
||||
shopt -s extglob
|
||||
|
||||
@@ -81,7 +85,9 @@ allow-hotplug ${networkInterface[$i]}
|
||||
iface ${networkInterface[$i]} inet dhcp
|
||||
EOF
|
||||
done
|
||||
elif [[ "${1}" == '--sources' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--sources' ]]; then
|
||||
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
|
||||
# ${VERSION_CODENAME^}
|
||||
Enabled: yes
|
||||
@@ -109,7 +115,9 @@ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
EOF
|
||||
|
||||
rm /mnt/etc/apt/sources.list
|
||||
elif [[ "${1}" == '--dpkg-reconfigure' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--dpkg-reconfigure' ]]; then
|
||||
cat << EOF
|
||||
|
||||
Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'!
|
||||
@@ -123,12 +131,16 @@ EOF
|
||||
tzdata \
|
||||
keyboard-configuration \
|
||||
console-setup
|
||||
elif [[ "${1}" == '--purge-os-prober' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--purge-os-prober' ]]; then
|
||||
apt \
|
||||
purge \
|
||||
--yes \
|
||||
os-prober
|
||||
elif [[ "${1}" == '--network-manager' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--network-manager' ]]; then
|
||||
cp \
|
||||
/etc/NetworkManager/NetworkManager.conf \
|
||||
/etc/NetworkManager/NetworkManager.conf.orig
|
||||
@@ -137,7 +149,9 @@ elif [[ "${1}" == '--network-manager' ]]; then
|
||||
/etc/NetworkManager/NetworkManager.conf.orig | \
|
||||
sed 's|managed=false|managed=true|' | \
|
||||
tee /etc/NetworkManager/NetworkManager.conf &> /dev/null
|
||||
elif [[ "${1}" == '--contrib' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--contrib' ]]; then
|
||||
cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
|
||||
|
||||
# ${VERSION_CODENAME^} Backports
|
||||
@@ -167,7 +181,9 @@ Pin: release n=${VERSION_CODENAME}-backports
|
||||
Pin-Priority: -1
|
||||
EOF
|
||||
fi
|
||||
elif [[ "${1}" == '--tasksel' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--tasksel' ]]; then
|
||||
if [[ ! -f /usr/bin/tasksel ]]; then
|
||||
apt \
|
||||
--update \
|
||||
@@ -178,7 +194,9 @@ elif [[ "${1}" == '--tasksel' ]]; then
|
||||
|
||||
tasksel \
|
||||
--new-install
|
||||
elif [[ "${1}" == '--initramfs' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--initramfs' ]]; then
|
||||
printf \
|
||||
"UMASK=0077\n" | \
|
||||
tee /etc/initramfs-tools/conf.d/umask.conf &> /dev/null
|
||||
@@ -186,13 +204,17 @@ elif [[ "${1}" == '--initramfs' ]]; then
|
||||
update-initramfs \
|
||||
-c \
|
||||
-k all
|
||||
elif [[ "${1}" == '--logrotate' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--logrotate' ]]; then
|
||||
for file in /etc/logrotate.d/* ; do
|
||||
if grep -Eq "(^|[^#y])compress" "$file" ; then
|
||||
sed -i -r "s/(^|[^#y])(compress)/\1#\2/" "$file"
|
||||
fi
|
||||
done
|
||||
elif [[ "${1}" == '--systemctl-enable' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--systemctl-enable' ]]; then
|
||||
systemctl \
|
||||
enable \
|
||||
zfs.target
|
||||
|
||||
@@ -45,7 +45,9 @@ zstd\
|
||||
${include} \
|
||||
"${UBUNTU_VERSION_CODENAME}" \
|
||||
/mnt
|
||||
elif [[ "${1}" == '--sources' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--sources' ]]; then
|
||||
cat <<EOF >/mnt/etc/apt/sources.list.d/${UBUNTU_VERSION_CODENAME}.sources
|
||||
# ${UBUNTU_VERSION_CODENAME^}
|
||||
Enabled: yes
|
||||
@@ -91,11 +93,15 @@ Signed-By: /etc/apt/trusted.gpg.d/patches.key.asc
|
||||
EOF
|
||||
|
||||
rm /mnt/etc/apt/sources.list
|
||||
elif [[ "${1}" == '--skel' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--skel' ]]; then
|
||||
rsync -pogAXtlHrDx \
|
||||
/etc/skel \
|
||||
/mnt/etc
|
||||
elif [[ "${1}" == '--elementary' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--elementary' ]]; then
|
||||
cp \
|
||||
/etc/os-release \
|
||||
/mnt/etc
|
||||
@@ -103,7 +109,9 @@ elif [[ "${1}" == '--elementary' ]]; then
|
||||
cp \
|
||||
/etc/apt/trusted.gpg.d/{elementary,patches}.key.asc \
|
||||
/mnt/etc/apt/trusted.gpg.d/
|
||||
elif [[ "${1}" == '--network' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--network' ]]; then
|
||||
mkdir \
|
||||
-p \
|
||||
/mnt/run/systemd/resolve/
|
||||
@@ -115,7 +123,9 @@ elif [[ "${1}" == '--network' ]]; then
|
||||
|
||||
touch \
|
||||
/mnt/etc/NetworkManager/conf.d/10-globally-managed-devices.conf
|
||||
elif [[ "${1}" == '--apps' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--apps' ]]; then
|
||||
app=(\
|
||||
io.elementary.calculator \
|
||||
io.elementary.camera \
|
||||
@@ -141,19 +151,25 @@ org.gnome.font-viewer\
|
||||
appcenter \
|
||||
-y \
|
||||
${apps}
|
||||
elif [[ "${1}" == '--purge' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--purge' ]]; then
|
||||
apt \
|
||||
purge \
|
||||
--yes \
|
||||
--autoremove \
|
||||
gnome-software \
|
||||
snapd
|
||||
elif [[ "${1}" == '--desktop' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--desktop' ]]; then
|
||||
apt \
|
||||
install \
|
||||
--yes \
|
||||
elementary-desktop
|
||||
elif [[ "${1}" == '--namarupa' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--namarupa' ]]; then
|
||||
curl \
|
||||
--progress \
|
||||
--location \
|
||||
|
||||
12
fedora.sh
12
fedora.sh
@@ -35,7 +35,9 @@ if [[ "${1}" == '--live' ]]; then
|
||||
|
||||
modprobe \
|
||||
zfs
|
||||
elif [[ "${1}" == '--rsync' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--rsync' ]]; then
|
||||
mkdir -p /run/install
|
||||
|
||||
if [[ "${VERSION_ID}" -lt '41' ]]; then
|
||||
@@ -50,14 +52,18 @@ elif [[ "${1}" == '--rsync' ]]; then
|
||||
--exclude=/etc/machine-id \
|
||||
--info=progress2 \
|
||||
/run/install/ /mnt
|
||||
elif [[ "${1}" == '--resolv-conf' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--resolv-conf' ]]; then
|
||||
mv /mnt/etc/resolv.conf \
|
||||
/mnt/etc/resolv.conf.orig
|
||||
|
||||
cp -L \
|
||||
/etc/resolv.conf \
|
||||
/mnt/etc
|
||||
elif [[ "${1}" == '--dracut' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--dracut' ]]; then
|
||||
dracut \
|
||||
--force \
|
||||
--regenerate-all
|
||||
|
||||
20
zfs.sh
20
zfs.sh
@@ -219,7 +219,9 @@ if [[ "${1}" == '--key' ]]; then
|
||||
cp \
|
||||
/etc/zfs/keys/${hostname,,}.key \
|
||||
/mnt/etc/zfs/keys/
|
||||
elif [[ "${1}" == '--unmount' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--unmount' ]]; then
|
||||
mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -I {} umount -Rlf {}
|
||||
|
||||
if [[ "${ID}" == 'fedora' ]]; then
|
||||
@@ -231,11 +233,15 @@ elif [[ "${1}" == '--unmount' ]]; then
|
||||
zpool \
|
||||
export \
|
||||
-a
|
||||
elif [[ "${1}" == '--host-id' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--host-id' ]]; then
|
||||
zgenhostid \
|
||||
-f \
|
||||
0x00bab10c
|
||||
elif [[ "${1}" == '--home' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--home' ]]; then
|
||||
zfs create\
|
||||
${hostname,,}/home/${username}
|
||||
|
||||
@@ -259,12 +265,16 @@ elif [[ "${1}" == '--home' ]]; then
|
||||
|
||||
zfs create\
|
||||
${hostname,,}/home/${username}/.local/share/flatpak
|
||||
elif [[ "${1}" == '--keystore' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--keystore' ]]; then
|
||||
zfs \
|
||||
set \
|
||||
org.zfsbootmenu:keysource=${hostname,,}/keystore \
|
||||
${hostname,,}
|
||||
elif [[ "${1}" == '--splash' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${1}" == '--splash' ]]; then
|
||||
zfs \
|
||||
set \
|
||||
org.zfsbootmenu:commandline='quiet splash rhgb noresume' \
|
||||
|
||||
Reference in New Issue
Block a user