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";
else
apt install -y p7zip-full libgumbo-dev libfuse-dev libssl-dev libcurl4-openssl-dev uuid-dev;
workingDirectory="$(pwd)";
tempDir="$(mktemp -d)";
cd "$tempDir";
pushd "$tempDir";
git clone https://github.com/fangfufu/httpdirfs.git;
pushd httpdirfs;
@ -28,5 +27,5 @@ else
unzip -d . CascadiaCode.zip;
cp ttf/* /usr/share/fonts/TTF;
cd "$workingDirectory";
popd;
fi

View file

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

View file

@ -1,6 +1,5 @@
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
pushd "$contextRoot";
sudo apt install -y \
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;
sudo ninja -C build install;
cd "$workingDirectory";
popd;
rm -rf "$contextRoot";

View file

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

View file

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

View file

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

View file

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

View file

@ -4,13 +4,12 @@ if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
else
workingDirectory="$(pwd)";
contextRoot="$(mktemp -d)";
cd "$contextRoot";
pushd "$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";
popd;
rm -rf "$contextRoot";
fi