Manage workind directories using pushd/popd

This commit is contained in:
Manuel Thalmann 2023-01-23 16:14:55 +01:00
parent d6234bd7c9
commit 38b9812d97
8 changed files with 17 additions and 26 deletions

View file

@ -5,9 +5,8 @@ then
sudo bash "$BASH_SOURCE" "$USER"; sudo bash "$BASH_SOURCE" "$USER";
else else
apt install -y p7zip-full libgumbo-dev libfuse-dev libssl-dev libcurl4-openssl-dev uuid-dev; apt install -y p7zip-full libgumbo-dev libfuse-dev libssl-dev libcurl4-openssl-dev uuid-dev;
workingDirectory="$(pwd)";
tempDir="$(mktemp -d)"; tempDir="$(mktemp -d)";
cd "$tempDir"; pushd "$tempDir";
git clone https://github.com/fangfufu/httpdirfs.git; git clone https://github.com/fangfufu/httpdirfs.git;
pushd httpdirfs; pushd httpdirfs;
@ -28,5 +27,5 @@ else
unzip -d . CascadiaCode.zip; unzip -d . CascadiaCode.zip;
cp ttf/* /usr/share/fonts/TTF; cp ttf/* /usr/share/fonts/TTF;
cd "$workingDirectory"; popd;
fi fi

View file

@ -1,23 +1,21 @@
#!/bin/bash #!/bin/bash
commandName=gnome-shell-extension-installer; commandName=gnome-shell-extension-installer;
extensionLocation=/usr/share/gnome-shell/extensions; extensionLocation=/usr/share/gnome-shell/extensions;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
cd "$contextRoot"; pushd "$contextRoot";
sudo apt install -y jq; sudo apt install -y jq;
wget -O "$commandName" "https://github.com/brunelli/gnome-shell-extension-installer/raw/master/gnome-shell-extension-installer"; wget -O "$commandName" "https://github.com/brunelli/gnome-shell-extension-installer/raw/master/gnome-shell-extension-installer";
sudo install "$commandName" /usr/local/bin; sudo install "$commandName" /usr/local/bin;
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";
for id in 779 4907 1162 for id in 779 4907 1162
do do
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
unzipLocation="$(mktemp -d)"; unzipLocation="$(mktemp -d)";
cd "$contextRoot"; pushd "$contextRoot";
gnome-shell-extension-installer "$id" --no-install; gnome-shell-extension-installer "$id" --no-install;
sudo gnome-shell-extension-installer "$id" --yes; sudo gnome-shell-extension-installer "$id" --yes;
@ -27,7 +25,7 @@ do
sudo chmod -R +r "$extensionLocation/$uuid"; sudo chmod -R +r "$extensionLocation/$uuid";
gnome-extensions enable "$uuid"; gnome-extensions enable "$uuid";
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";
done done

View file

@ -1,6 +1,5 @@
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
cd "$contextRoot"; pushd "$contextRoot";
sudo apt install -y \ sudo apt install -y \
build-essential meson ninja-build pkg-config libgnutls28-dev openssl \ build-essential meson ninja-build pkg-config libgnutls28-dev openssl \
@ -15,5 +14,5 @@ meson build -Dpipelines=uvcvideo,vimc,ipu3 -Dipas=vimc,ipu3 -Dprefix=/usr -Dgstr
ninja -C build; ninja -C build;
sudo ninja -C build install; sudo ninja -C build install;
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";

View file

@ -8,10 +8,9 @@ then
bash "$scriptRoot/sign-modules.sh"; bash "$scriptRoot/sign-modules.sh";
else else
# Create context directory # Create context directory
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
packageName="shim.rpm"; packageName="shim.rpm";
cd "$contextRoot"; pushd "$contextRoot";
# Install Prerequisites # Install Prerequisites
apt install -y wget rpm2cpio efitools; apt install -y wget rpm2cpio efitools;
@ -89,6 +88,6 @@ else
mokutil --import "$keyDir/MOK.der"; mokutil --import "$keyDir/MOK.der";
# Remove context directory # Remove context directory
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";
fi fi

View file

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

View file

@ -5,14 +5,13 @@ then
sudo bash "$BASH_SOURCE" "$USER"; sudo bash "$BASH_SOURCE" "$USER";
else else
bin=oh-my-posh; bin=oh-my-posh;
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
cd "$contextRoot"; pushd "$contextRoot";
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O "$bin"; wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O "$bin";
install "$bin" /usr/local/bin; install "$bin" /usr/local/bin;
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";
homeDir="$(sudo -u "$1" bash -c 'realpath ~')"; homeDir="$(sudo -u "$1" bash -c 'realpath ~')";

View file

@ -4,7 +4,6 @@ if [ ! "$UID" -eq 0 ]
then then
sudo bash "$BASH_SOURCE"; sudo bash "$BASH_SOURCE";
else else
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)"; contextRoot="$(mktemp -d)";
cd "$contextRoot"; cd "$contextRoot";
@ -19,6 +18,6 @@ else
tar -xvzf woodpecker-cli.tar.gz; tar -xvzf woodpecker-cli.tar.gz;
install woodpecker-cli /usr/local/bin; install woodpecker-cli /usr/local/bin;
cd "$workingDirectory"; popd;
rm -rf "$contextRoot"; rm -rf "$contextRoot";
fi fi

View file

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