Put dynamic expressions in quotes

This commit is contained in:
Manuel Thalmann 2023-01-23 16:11:51 +01:00
parent c59b48b50b
commit d6234bd7c9
15 changed files with 102 additions and 102 deletions

View file

@ -7,7 +7,7 @@ else
apt install -y p7zip-full libgumbo-dev libfuse-dev libssl-dev libcurl4-openssl-dev uuid-dev;
workingDirectory="$(pwd)";
tempDir="$(mktemp -d)";
cd $tempDir;
cd "$tempDir";
git clone https://github.com/fangfufu/httpdirfs.git;
pushd httpdirfs;
@ -23,10 +23,10 @@ else
rm -f /usr/local/bin/httpdirfs;
cd $tempDir;
cd "$tempDir";
wget -O CascadiaCode.zip https://github.com/microsoft/cascadia-code/releases/download/v2111.01/CascadiaCode-2111.01.zip;
unzip -d . CascadiaCode.zip;
cp ttf/* /usr/share/fonts/TTF;
cd $workingDirectory;
cd "$workingDirectory";
fi

View file

@ -4,11 +4,11 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE" "$USER";
else
homeDir=$(sudo -u $1 bash -c 'realpath ~');
homeDir="$(sudo -u "$1" bash -c 'realpath ~')";
fontFileBaseName="Caskaydia Cove Regular Nerd Font Complete.otf";
tempFile=$(sudo -u $1 mktemp -d)/$fontFileBaseName;
tempFile="$(sudo -u "$1" mktemp -d)/$fontFileBaseName";
destination=/usr/share/font/opentype;
sudo -u $1 cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" "$tempFile";
sudo -u "$1" cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" "$tempFile";
cp "$tempFile" /usr/share/fonts/opentype;
fi

View file

@ -1,8 +1,8 @@
#!/bin/bash
commandName=gnome-shell-extension-installer;
extensionLocation=/usr/share/gnome-shell/extensions;
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
sudo apt install -y jq;
@ -14,15 +14,15 @@ rm -rf "$contextRoot";
for id in 779 4907 1162
do
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
unzipLocation=$(mktemp -d);
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
unzipLocation="$(mktemp -d)";
cd "$contextRoot";
gnome-shell-extension-installer $id --no-install;
sudo gnome-shell-extension-installer $id --yes;
gnome-shell-extension-installer "$id" --no-install;
sudo gnome-shell-extension-installer "$id" --yes;
unzip ./*.zip -d "$unzipLocation";
uuid=$(jq -r '.uuid' "$unzipLocation/metadata.json");
uuid="$(jq -r '.uuid' "$unzipLocation/metadata.json")";
sudo chmod -R +r "$extensionLocation/$uuid";
gnome-extensions enable "$uuid";

View file

@ -1,13 +1,13 @@
#!/bin/bash
provider=$1;
dirname=$2;
serviceName=rclone@$provider:$dirname;
provider="$1";
dirname="$2";
serviceName="rclone@$provider:$dirname";
echo "Please create a remote called \`$1\`";
rclone config;
mkdir -p ~/$dirname;
mkdir -p "~/$dirname";
systemctl --user enable $serviceName;
systemctl --user enable "$serviceName";
systemctl --user daemon-reload;
systemctl --user start $serviceName;
systemctl --user start "$serviceName";

View file

@ -15,8 +15,8 @@ else
systemctl enable iptsd;
# Install DTX
package=$(mktemp);
wget https://github.com/linux-surface/surface-dtx-daemon/releases/download/v0.3.3-2/surface-dtx-daemon_0.3.3-2_amd64.deb -O $package;
dpkg -i $package;
rm -f $package;
package="$(mktemp)";
wget https://github.com/linux-surface/surface-dtx-daemon/releases/download/v0.3.3-2/surface-dtx-daemon_0.3.3-2_amd64.deb -O "$package";
dpkg -i "$package";
rm -f "$package";
fi

View file

@ -1,5 +1,5 @@
#!/bin/bash
scriptRoot=$(realpath "${BASH_SOURCE%/*}");
scriptRoot="$(realpath "${BASH_SOURCE%/*}")";
# Elevate script
if [ ! "$UID" -eq 0 ]
@ -25,18 +25,18 @@ else
# Initialize variables
src="./boot/efi/EFI/fedora";
esp=/boot/efi;
defaultBootDir=$esp/EFI/BOOT;
microsoftBootDir=$esp/EFI/Microsoft/Boot;
defaultBootDir="$esp/EFI/BOOT";
microsoftBootDir="$esp/EFI/Microsoft/Boot";
systemdDirName=/EFI/systemd;
systemdFullName=$esp$systemdDirName;
systemdFile=$systemdFullName/systemd-bootx64.efi;
bootFile=$defaultBootDir/grubx64.efi;
systemdFullName="$esp$systemdDirName";
systemdFile="$systemdFullName/systemd-bootx64.efi";
bootFile="$defaultBootDir/grubx64.efi";
# Set up files
cp $systemdFile $bootFile;
cp "$src/shimx64.efi" $defaultBootDir/BOOTx64.efi;
cp "$src/mmx64.efi" $defaultBootDir;
cp "$systemdFile" "$bootFile";
cp "$src/shimx64.efi" "$defaultBootDir/BOOTx64.efi";
cp "$src/mmx64.efi" "$defaultBootDir";
cp /usr/lib/efitools/x86_64-linux-gnu/KeyTool.efi /boot/efi/EFI/systemd/;
wget https://github.com/tianocore/edk2-archive/raw/master/ShellBinPkg/UefiShell/X64/Shell.efi -O "$systemdFullName/Shell.efi";
@ -89,6 +89,6 @@ else
mokutil --import "$keyDir/MOK.der";
# Remove context directory
cd $workingDirectory;
rm -rf $contextRoot;
cd "$workingDirectory";
rm -rf "$contextRoot";
fi

View file

@ -10,6 +10,6 @@ else
for file in $(find /lib/modules /var/lib/dkms -name *.ko);
do
kmodsign sha512 $keyFile $pubFile $file;
kmodsign sha512 "$keyFile" "$pubFile" "$file";
done
fi

View file

@ -5,46 +5,46 @@ then
sudo bash "$BASH_SOURCE" "$USER";
else
# Download and extract `youtube-music-dl`
archiveName=$(sudo -u $1 mktemp);
sudo -u $1 wget https://github.com/dougppaz/youtube-music-dl/releases/download/v1.2.1/youtube-music-dl.zip -O $archiveName;
archiveName="$(sudo -u "$1" mktemp)";
sudo -u "$1" wget https://github.com/dougppaz/youtube-music-dl/releases/download/v1.2.1/youtube-music-dl.zip -O "$archiveName";
extensionName=youtube-music-dl;
contextRoot=$(sudo -u $1 mktemp -d);
extensionDir=$contextRoot/$extensionName;
keyFile=$extensionDir.pem;
extensionFile=$extensionDir.crx;
manifestFile=$extensionDir/manifest.json;
contextRoot="$(sudo -u "$1" mktemp -d)";
extensionDir="$contextRoot/$extensionName";
keyFile="$extensionDir.pem";
extensionFile="$extensionDir.crx";
manifestFile="$extensionDir/manifest.json";
extensionRoot=/usr/share/brave-extensions;
destination=$extensionRoot/$extensionName.crx;
destination="$extensionRoot/$extensionName.crx";
# Prepare extension
mkdir -p $extensionRoot;
sudo -u $1 unzip $archiveName -d $extensionDir;
sudo -u $1 brave-browser --pack-extension=$extensionDir;
rm $archiveName;
mkdir -p "$extensionRoot";
sudo -u "$1" unzip "$archiveName" -d "$extensionDir";
sudo -u "$1" brave-browser --pack-extension="$extensionDir";
rm "$archiveName";
# Tamper manifest file
manifest="$(cat $manifestFile | jq ". + {key: "'"'"$(openssl rsa -in $keyFile -pubout -outform DER | openssl base64 -A)"'"'"}")";
manifest="$(echo $manifest | jq ".background.persistent = false")";
echo $manifest | sudo -u $1 tee $manifestFile;
manifest="$(cat "$manifestFile" | jq ". + {key: "'"'"$(openssl rsa -in "$keyFile" -pubout -outform DER | openssl base64 -A)"'"'"}")";
manifest="$(echo "$manifest" | jq ".background.persistent = false")";
echo "$manifest" | sudo -u "$1" tee "$manifestFile";
# Pack extension
extensionID=$(openssl rsa -in $keyFile -pubout -outform DER | sha256sum | head -c32 | tr 0-9a-f a-p);
extensionVersion=$(cat $manifestFile | jq -r '.version');
sudo -u $1 brave-browser --pack-extension=$extensionDir --pack-extension-key=$keyFile;
extensionID="$(openssl rsa -in "$keyFile" -pubout -outform DER | sha256sum | head -c32 | tr 0-9a-f a-p)";
extensionVersion="$(cat "$manifestFile" | jq -r '.version')";
sudo -u "$1" brave-browser --pack-extension="$extensionDir" --pack-extension-key="$keyFile";
# Install extension and preinstall it
cp $extensionFile $extensionRoot;
configRoot=/opt/brave.com/brave/extensions/;
rm -rf $contextRoot;
chmod -R a+rx $extensionRoot;
chmod -R u+w $extensionRoot;
mkdir -p $configRoot;
cp "$extensionFile" "$extensionRoot";
configRoot=/opt/brave.com/brave/extensions/
rm -rf "$contextRoot";
chmod -R a+rx "$extensionRoot";
chmod -R u+w "$extensionRoot";
mkdir -p "$configRoot";
{
echo "{";
echo ' "external_crx": "'"$destination"'",';
echo ' "external_version": "'"$extensionVersion"'"';
echo "}";
} | tee $configRoot/$extensionID.json;
} | tee "$configRoot/$extensionID.json";
fi

View file

@ -4,15 +4,15 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
else
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
cd $contextRoot;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
curl -fsSL https://raw.githubusercontent.com/nagygergo/jetbrains-toolbox-install/1.1/jetbrains-toolbox.sh \
| bash;
cd $workingDirectory;
rm -rf $contextRoot;
cd "$workingDirectory";
rm -rf "$contextRoot";
{
echo "[Desktop Entry]";

View file

@ -5,21 +5,21 @@ then
sudo bash "$BASH_SOURCE" "$USER";
else
bin=oh-my-posh;
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
cd $contextRoot;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O $bin;
install $bin /usr/local/bin;
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O "$bin";
install "$bin" /usr/local/bin;
cd $workingDirectory;
rm -rf $contextRoot;
cd "$workingDirectory";
rm -rf "$contextRoot";
homeDir=$(sudo -u $1 bash -c 'realpath ~');
homeDir="$(sudo -u "$1" bash -c 'realpath ~')";
sudo -u $1 mkdir -p $homeDir/.omp;
sudo -u $1 cp $homeDir/Nextcloud/.omp/manuel.omp.json $homeDir/.omp/manuel.omp.json;
sudo -u "$1" mkdir -p "$homeDir/.omp";
sudo -u "$1" cp "$homeDir/Nextcloud/.omp/manuel.omp.json" "$homeDir/.omp/manuel.omp.json";
echo 'eval "$(oh-my-posh init bash --config ~/.omp/manuel.omp.json)"' \
| sudo -u $1 tee -a $homeDir/.bashrc;
| sudo -u "$1" tee -a "$homeDir/.bashrc";
fi

View file

@ -5,17 +5,17 @@ then
sudo bash "$BASH_SOURCE";
else
apt install -y wget gpg;
keyFile=$(mktemp);
keyFile="$(mktemp)";
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
| gpg --dearmor > $keyFile;
| gpg --dearmor > "$keyFile";
install -D -o root -g root -m 644 $keyFile /etc/apt/keyrings/packages.microsoft.gpg;
install -D -o root -g root -m 644 "$keyFile" /etc/apt/keyrings/packages.microsoft.gpg;
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" \
| tee /etc/apt/sources.list.d/vscode.list;
rm -f $keyFile;
rm -f "$keyFile";
apt update;
apt install -y code;

View file

@ -4,9 +4,9 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
else
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
cd $contextRoot;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
# Preview from docker container
# container_id="$(docker create woodpeckerci/woodpecker-cli:next)"
@ -19,6 +19,6 @@ else
tar -xvzf woodpecker-cli.tar.gz;
install woodpecker-cli /usr/local/bin;
cd $workingDirectory;
rm -rf $contextRoot;
cd "$workingDirectory";
rm -rf "$contextRoot";
fi

View file

@ -4,16 +4,16 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE" "$USER";
else
package=$(mktemp);
wget https://github.com/Yash-Handa/logo-ls/releases/download/v1.3.7/logo-ls_amd64.deb -O $package;
dpkg -i $package;
rm -f $package;
package="$(mktemp)";
wget https://github.com/Yash-Handa/logo-ls/releases/download/v1.3.7/logo-ls_amd64.deb -O "$package";
dpkg -i "$package";
rm -f "$package";
homeDir=$(sudo -u $1 bash -c 'realpath ~');
homeDir="$(sudo -u "$1" bash -c 'realpath ~')";
{
echo "alias ls='logo-ls -D'";
echo "alias ll='ls -al'";
echo "alias l='ls'";
} | sudo -u $1 tee -a $homeDir/.bashrc;
} | sudo -u "$1" tee -a "$homeDir/.bashrc";
fi

View file

@ -4,10 +4,10 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
else
package=$(mktemp);
wget https://github.com/rclone/rclone/releases/download/v1.60.0/rclone-v1.60.0-linux-amd64.deb -O $package;
dpkg -i $package;
rm -f $package;
package="$(mktemp)";
wget https://github.com/rclone/rclone/releases/download/v1.60.0/rclone-v1.60.0-linux-amd64.deb -O "$package";
dpkg -i "$package";
rm -f "$package";
cp ${BASH_SOURCE%/*}/rclone@.service /etc/systemd/user;
cp "${BASH_SOURCE%/*}/rclone@.service" /etc/systemd/user;
fi

View file

@ -4,13 +4,13 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
else
workingDirectory=$(pwd);
contextRoot=$(mktemp -d);
cd $contextRoot;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
wget https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 -O tea;
install tea /usr/local/bin;
cd $workingDirectory;
rm -rf $contextRoot;
cd "$workingDirectory";
rm -rf "$contextRoot";
fi