From 658315cc94f10945d71ebf043456674a65a397eb Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Thu, 28 Nov 2019 20:01:33 +0000 Subject: [PATCH] Lowercase variable --- scripts/bash_tweaks.sh | 10 +++++----- scripts/firewall.sh | 4 ++-- scripts/go.sh | 10 +++++----- scripts/grub.sh | 4 ++-- scripts/install_client.sh | 19 +++++++++---------- scripts/ssh.sh | 4 ++-- scripts/ubuntu_tweaks.sh | 22 +++++++++++----------- scripts/vscode.sh | 10 +++++----- 8 files changed, 41 insertions(+), 42 deletions(-) diff --git a/scripts/bash_tweaks.sh b/scripts/bash_tweaks.sh index d2916641..cfaaf7e2 100755 --- a/scripts/bash_tweaks.sh +++ b/scripts/bash_tweaks.sh @@ -37,13 +37,13 @@ fi EOF # Set-up all users -for DIR in $(ls -1d /root /home/* 2>/dev/null ||:) +for dir in $(ls -1d /root /home/* 2>/dev/null ||:) do # Hide login informations - touch $DIR/.hushlogin + touch $dir/.hushlogin # Add convenient aliases & behaviors - cat <<-'EOF'>> $DIR/.bashrc + cat <<-'EOF'>> $dir/.bashrc export LS_OPTIONS="--color=auto" eval "`dircolors`" @@ -63,6 +63,6 @@ do EOF # Fix rights - USR=$(echo "$DIR" | rev | cut -d/ -f1 | rev) - chown -R $USR:$USR $DIR ||: + usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) + chown -R $usr:$usr $dir ||: done diff --git a/scripts/firewall.sh b/scripts/firewall.sh index 6735efd8..e81f7212 100755 --- a/scripts/firewall.sh +++ b/scripts/firewall.sh @@ -6,12 +6,12 @@ script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" cd $script_dir . set.sh -SSH_PORT=${1:-521} +ssh_port=${1:-521} apt-get -y install ufw ufw logging off -ufw allow in "$SSH_PORT"/tcp +ufw allow in "$ssh_port"/tcp ufw allow in 27960:27969/tcp ufw allow in 27960:27969/udp ufw --force enable diff --git a/scripts/go.sh b/scripts/go.sh index b1a7e4b3..e2014622 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -9,17 +9,17 @@ cd $script_dir apt-get -y install golang # Set-up all users -for DIR in $(ls -1d /root /home/* 2>/dev/null ||:) +for dir in $(ls -1d /root /home/* 2>/dev/null ||:) do # Add convenient aliases & behaviors - cat <<-'EOF'>> $DIR/.bashrc + cat <<-'EOF'>> $dir/.bashrc GOPATH=$HOME/go PATH=$PATH:$GOPATH/bin alias gobuild='CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w"' EOF - echo 'GOPATH=$HOME/go' >> $DIR/.profile + echo 'GOPATH=$HOME/go' >> $dir/.profile # Fix rights - USR=$(echo "$DIR" | rev | cut -d/ -f1 | rev) - chown -R $USR:$USR $DIR ||: + usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) + chown -R $usr:$usr $dir ||: done diff --git a/scripts/grub.sh b/scripts/grub.sh index 1eb0bb1e..54b9e32f 100755 --- a/scripts/grub.sh +++ b/scripts/grub.sh @@ -6,7 +6,7 @@ script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" cd $script_dir . set.sh -DISK=$1 +disk=$1 sed -i -e 's/message=/message_null=/g' /etc/grub.d/10_linux @@ -20,4 +20,4 @@ GRUB_DISABLE_SUBMENU=y EOF update-grub -grub-install $DISK +grub-install $disk diff --git a/scripts/install_client.sh b/scripts/install_client.sh index 27f1da04..0bb54013 100755 --- a/scripts/install_client.sh +++ b/scripts/install_client.sh @@ -9,8 +9,7 @@ script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" cd $script_dir . set.sh -SSH_PORT=521 -DISK=$(lsblk -o tran,kname,hotplug,type,fstype -pr | +disk=$(lsblk -o tran,kname,hotplug,type,fstype -pr | grep -e nvme -e sata | grep '0 disk' | cut -d' ' -f2 | @@ -19,10 +18,10 @@ DISK=$(lsblk -o tran,kname,hotplug,type,fstype -pr | systemctl stop unattended-upgrades.service -sgdisk -n0:0:+32G "$DISK" -sgdisk -N0 "$DISK" -sgdisk -c3:01-tmp-home "$DISK" -sgdisk -c4:01-tmp-system "$DISK" +sgdisk -n0:0:+32G "$disk" +sgdisk -N0 "$disk" +sgdisk -c3:01-tmp-home "$disk" +sgdisk -c4:01-tmp-system "$disk" apt-get update apt-get -y upgrade @@ -41,7 +40,7 @@ apt-get -yf install . ssh.sh . firewall.sh . ubuntu_tweaks.sh -. grub.sh "$DISK" +. grub.sh "$disk" . go.sh . nodejs.sh . fx.sh @@ -51,7 +50,7 @@ apt-get -yf install . exam.sh # Install additional packages -PKGS=" +pkgs=" emacs f2fs-tools golang-mode @@ -59,7 +58,7 @@ vim xfsprogs " -apt-get -y install $PKGS +apt-get -y install $pkgs # Install additional drivers ubuntu-drivers install @@ -91,7 +90,7 @@ find . -type f -exec chmod 644 {} \; find . -type f -exec /bin/sh -c "file {} | grep -q 'shell script' && chmod +x {}" \; find . -type f -exec /bin/sh -c "file {} | grep -q 'public key' && chmod 400 {}" \; -sed -i -e "s|::DISK::|$DISK|g" etc/udev/rules.d/10-local.rules +sed -i -e "s|::DISK::|$disk|g" etc/udev/rules.d/10-local.rules # Generate wallpaper cd usr/share/backgrounds/01 diff --git a/scripts/ssh.sh b/scripts/ssh.sh index cd754ef6..ff640517 100755 --- a/scripts/ssh.sh +++ b/scripts/ssh.sh @@ -6,13 +6,13 @@ script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" cd $script_dir . set.sh -SSH_PORT=${1:-521} +ssh_port=${1:-521} # Install dependencies apt-get -y install ssh cat <> /etc/ssh/sshd_config -Port $SSH_PORT +Port $ssh_port PasswordAuthentication no AllowUsers root EOF diff --git a/scripts/ubuntu_tweaks.sh b/scripts/ubuntu_tweaks.sh index b0194c58..594edcf6 100755 --- a/scripts/ubuntu_tweaks.sh +++ b/scripts/ubuntu_tweaks.sh @@ -41,7 +41,7 @@ sed -i '/swapfile/d' /etc/fstab # Purge unused Ubuntu packages -PKGS=" +pkgs=" apport bind9 bolt @@ -73,10 +73,10 @@ whoopsie xdg-desktop-portal " -apt-get -y purge $PKGS +apt-get -y purge $pkgs apt-get -y autoremove --purge -SERVICES=" +services=" apt-daily-upgrade.timer apt-daily.timer console-setup.service @@ -84,16 +84,16 @@ keyboard-setup.service motd-news.timer remote-fs.target " -systemctl disable $SERVICES +systemctl disable $services -SERVICES=" +services=" grub-common.service plymouth-quit-wait.service " -systemctl mask $SERVICES +systemctl mask $services # Install packages -PKGS="$(cat common_packages.txt) +pkgs="$(cat common_packages.txt) baobab blender dconf-editor @@ -109,8 +109,8 @@ zenity " # Replace debian packages with ubuntu's -PKGS=${PKGS/linux-image-amd64/linux-image-generic} -PKGS=${PKGS/linux-headers-amd64/linux-headers-generic} -PKGS=${PKGS/firmware-linux-nonfree} +pkgs=${pkgs/linux-image-amd64/linux-image-generic} +pkgs=${pkgs/linux-headers-amd64/linux-headers-generic} +pkgs=${pkgs/firmware-linux-nonfree} -apt-get -y install $PKGS +apt-get -y install $pkgs diff --git a/scripts/vscode.sh b/scripts/vscode.sh index 7565f948..c0735d2b 100755 --- a/scripts/vscode.sh +++ b/scripts/vscode.sh @@ -12,11 +12,11 @@ dpkg -i codium_1.40.2-1574798581_amd64.deb ln -s /usr/bin/codium /usr/local/bin/code # Set-up all users -for DIR in $(ls -1d /home/* 2>/dev/null ||:) +for dir in $(ls -1d /home/* 2>/dev/null ||:) do # Disable most of the telemetry and auto-updates - mkdir -p $DIR/.config/VSCodium/User - cat <<-'EOF'> $DIR/.config/VSCodium/User/settings.json + mkdir -p $dir/.config/VSCodium/User + cat <<-'EOF'> $dir/.config/VSCodium/User/settings.json { "telemetry.enableCrashReporter": false, "update.enableWindowsBackgroundUpdates": false, @@ -31,6 +31,6 @@ do EOF # Fix rights - USR=$(echo "$DIR" | rev | cut -d/ -f1 | rev) - chown -R $USR:$USR $DIR ||: + usr=$(echo "$dir" | rev | cut -d/ -f1 | rev) + chown -R $usr:$usr $dir ||: done