Skip to content

Commit 5bb4979

Browse files
committed
chore: fix shellcheck findings before review
1 parent 61e76d6 commit 5bb4979

File tree

5 files changed

+42
-34
lines changed

5 files changed

+42
-34
lines changed

core/tabs/applications-setup/linutil-installer.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#!/bin/sh -e
22

3+
# shellcheck source=core/tabs/common-script.sh
34
. ../common-script.sh
45

6+
installExtra() {
7+
printf "%b\n" "${YELLOW}Installing the manpage...${RC}"
8+
"$ESCALATION_TOOL" mkdir -p /usr/share/man/man1
9+
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' > /dev/null
10+
printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}"
11+
"$ESCALATION_TOOL" mkdir -p /usr/share/applications
12+
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop > /dev/null
13+
printf "%b\n" "${GREEN}Done.${RC}"
14+
}
15+
516
installLinutil() {
617
printf "%b\n" "${YELLOW}Installing Linutil...${RC}"
718
case "$PACKAGER" in
@@ -35,6 +46,7 @@ installLinutil() {
3546
read -r choice
3647
case $choice in
3748
y | Y)
49+
# shellcheck disable=SC2218
3850
if ! command_exists cargo; then
3951
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
4052
case "$PACKAGER" in
@@ -64,16 +76,6 @@ installLinutil() {
6476
esac
6577
}
6678

67-
installExtra() {
68-
printf "%b\n" "${YELLOW}Installing the manpage...${RC}"
69-
"$ESCALATION_TOOL" mkdir -p /usr/share/man/man1
70-
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' > /dev/null
71-
printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}"
72-
"$ESCALATION_TOOL" mkdir -p /usr/share/applications
73-
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop > /dev/null
74-
printf "%b\n" "${GREEN}Done.${RC}"
75-
}
76-
7779
checkEnv
7880
checkAURHelper
7981
installLinutil
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh -e
2+
3+
# Placeholder script used for script-access testing.

core/tabs/system-setup/arch/server-setup.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ select_option() {
102102
;;
103103
'[B') # Down arrow
104104
((selected++))
105-
if [ $selected -ge $num_options ]; then
105+
if [ "$selected" -ge "$num_options" ]; then
106106
selected=0
107107
fi
108108
;;
@@ -508,18 +508,18 @@ pacman -S --noconfirm --needed pacman-contrib curl terminus-font
508508
pacman -S --noconfirm --needed reflector rsync grub arch-install-scripts git ntp wget
509509
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
510510
511-
nc=$(grep -c ^"cpu cores" /proc/cpuinfo)
512-
echo -ne "
511+
NCORES=$(grep -c ^"cpu cores" /proc/cpuinfo)
512+
cat <<EOF
513513
-------------------------------------------------------------------------
514-
You have " $nc" cores. And
515-
changing the makeflags for " $nc" cores. Aswell as
514+
You have $NCORES cores. And
515+
changing the makeflags for $NCORES cores. Aswell as
516516
changing the compression settings.
517517
-------------------------------------------------------------------------
518-
"
518+
EOF
519519
TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
520520
if [[ $TOTAL_MEM -gt 8000000 ]]; then
521-
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf
522-
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf
521+
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$NCORES\"/g" /etc/makepkg.conf
522+
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $NCORES -z -)/g" /etc/makepkg.conf
523523
fi
524524
echo -ne "
525525
-------------------------------------------------------------------------
@@ -528,10 +528,10 @@ echo -ne "
528528
"
529529
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
530530
locale-gen
531-
timedatectl --no-ask-password set-timezone ${TIMEZONE}
531+
timedatectl --no-ask-password set-timezone "${TIMEZONE}"
532532
timedatectl --no-ask-password set-ntp 1
533533
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8"
534-
ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
534+
ln -s "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
535535

536536
# Set keymaps
537537
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf
@@ -594,11 +594,11 @@ echo -ne "
594594
-------------------------------------------------------------------------
595595
"
596596
groupadd libvirt
597-
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
597+
useradd -m -G wheel,libvirt -s /bin/bash "$USERNAME"
598598
echo "$USERNAME created, home directory created, added to wheel and libvirt group, default shell set to /bin/bash"
599599
echo "$USERNAME:$PASSWORD" | chpasswd
600600
echo "$USERNAME password set"
601-
echo $NAME_OF_MACHINE > /etc/hostname
601+
echo "$NAME_OF_MACHINE" > /etc/hostname
602602

603603
if [[ ${FS} == "luks" ]]; then
604604
# Making sure to edit mkinitcpio conf if luks is selected
@@ -625,7 +625,7 @@ GRUB EFI Bootloader Install & Check
625625
"
626626

627627
if [[ -d "/sys/firmware/efi" ]]; then
628-
grub-install --efi-directory=/boot ${DISK}
628+
grub-install --efi-directory=/boot "${DISK}"
629629
fi
630630

631631
echo -ne "

core/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ installDriver() {
5252
"$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
5353
printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}"
5454

55-
for i in $(seq 1 5); do
55+
for _ in $(seq 1 5); do
5656
if checkDriverInstallation; then
5757
printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
5858
printf "%b\n" "${GREEN}Installed driver version $(modinfo -F version nvidia)${RC}"

core/tabs/utils/ssh.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ disable_password_auth() {
6161
printf "%b\n" "Enter the alias of the host: "
6262
read -r host_alias
6363
printf "\n"
64+
# shellcheck disable=SC2029
6465
ssh "$host_alias" "
65-
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
66-
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
67-
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
68-
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
69-
"$ESCALATION_TOOL" -S systemctl restart sshd
66+
${ESCALATION_TOOL} -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
67+
${ESCALATION_TOOL} -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
68+
${ESCALATION_TOOL} -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
69+
${ESCALATION_TOOL} -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
70+
${ESCALATION_TOOL} -S systemctl restart sshd
7071
"
7172
printf "%b\n" "PasswordAuthentication set to no and PubkeyAuthentication set to yes."
7273
}
@@ -76,12 +77,13 @@ enable_password_auth() {
7677
printf "%b\n" "Enter the alias of the host: "
7778
read -r host_alias
7879
printf "\n"
80+
# shellcheck disable=SC2029
7981
ssh "$host_alias" "
80-
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
81-
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
82-
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
83-
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
84-
"$ESCALATION_TOOL" -S systemctl restart sshd
82+
${ESCALATION_TOOL} -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
83+
${ESCALATION_TOOL} -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
84+
${ESCALATION_TOOL} -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
85+
${ESCALATION_TOOL} -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
86+
${ESCALATION_TOOL} -S systemctl restart sshd
8587
"
8688
printf "%b\n" "PasswordAuthentication set to yes and PubkeyAuthentication set to no."
8789
}
@@ -99,6 +101,7 @@ run_remote_command() {
99101
read -r host_alias
100102
printf "%b" "Enter the command to run: "
101103
read -r remote_command
104+
# shellcheck disable=SC2029
102105
ssh "$host_alias" "$remote_command"
103106
}
104107

0 commit comments

Comments
 (0)