Fix elevation script

This commit is contained in:
Manuel Thalmann 2022-11-13 01:11:32 +01:00
parent 491b354971
commit 7d40b6d3f5
15 changed files with 235 additions and 235 deletions

View file

@ -2,8 +2,8 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0" "$USER"
sudo bash "$BASH_SOURCE" "$USER"
else
homeDir=$(sudo -u $1 bash -c 'realpath ~')
cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" /usr/share/font/opentype
fi
homeDir=$(sudo -u $1 bash -c 'realpath ~')
cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" /usr/share/font/opentype

View file

@ -2,21 +2,21 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
fi
sudo bash "$BASH_SOURCE"
else
wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/linux-surface.gpg
wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/linux-surface.gpg
echo "deb [arch=amd64] https://pkg.surfacelinux.com/debian release main" \
| sudo tee /etc/apt/sources.list.d/linux-surface.list
echo "deb [arch=amd64] https://pkg.surfacelinux.com/debian release main" \
| sudo tee /etc/apt/sources.list.d/linux-surface.list
apt update
apt update
apt install -y linux-image-surface linux-headers-surface iptsd libwacom-surface
systemctl enable iptsd
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
# 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
fi

View file

@ -2,45 +2,45 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
# Create context directory
workingDirectory=$(pwd)
contextRoot=$(mktemp -d)
cd $contextRoot
# Initialize variables
esp=/boot/efi
defaultBootDir=$esp/EFI/BOOT
microsoftBootDir=$esp/EFI/Microsoft/Boot
systemdDirName=/EFI/systemd
systemdFullName=$esp$systemdDirName
systemdFile=$systemdFullName/systemd-bootx64.efi
loaderBaseName=loader.efi
systemdLoaderFile=$systemdFullName/$loaderBaseName
# Install PreLoader
wget https://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi
wget https://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi
cp {HashTool,PreLoader}.efi $systemdFullName
cp $systemdFile $systemdLoaderFile
efibootmgr --unicode --disk /dev/nvme0n1 --part 0 --create --label "PreLoader" --loader $systemdDirName/PreLoader.efi
# Add fallbacks
cp ./HashTool.efi $defaultBootDir
cp $systemdFile $defaultBootDir/$loaderBaseName
cp ./PreLoader.efi $defaultBootDir/BOOTx64.EFI
# Add Microsoft fallbacks
mkdir -p $microsoftBootDir
cp ./PreLoader.efi $microsoftBootDir/bootmgfw.efi
cp ./HashTool.efi $microsoftBootDir
cp $systemdFile $microsoftBootDir/$loaderBaseName
# Remove context directory
cd $workingDirectory
rm -rf $contextRoot
fi
# Create context directory
workingDirectory=$(pwd)
contextRoot=$(mktemp -d)
cd $contextRoot
# Initialize variables
esp=/boot/efi
defaultBootDir=$esp/EFI/BOOT
microsoftBootDir=$esp/EFI/Microsoft/Boot
systemdDirName=/EFI/systemd
systemdFullName=$esp$systemdDirName
systemdFile=$systemdFullName/systemd-bootx64.efi
loaderBaseName=loader.efi
systemdLoaderFile=$systemdFullName/$loaderBaseName
# Install PreLoader
wget https://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi
wget https://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi
cp {HashTool,PreLoader}.efi $systemdFullName
cp $systemdFile $systemdLoaderFile
efibootmgr --unicode --disk /dev/nvme0n1 --part 0 --create --label "PreLoader" --loader $systemdDirName/PreLoader.efi
# Add fallbacks
cp ./HashTool.efi $defaultBootDir
cp $systemdFile $defaultBootDir/$loaderBaseName
cp ./PreLoader.efi $defaultBootDir/BOOTx64.EFI
# Add Microsoft fallbacks
mkdir -p $microsoftBootDir
cp ./PreLoader.efi $microsoftBootDir/bootmgfw.efi
cp ./HashTool.efi $microsoftBootDir
cp $systemdFile $microsoftBootDir/$loaderBaseName
# Remove context directory
cd $workingDirectory
rm -rf $contextRoot

View file

@ -2,17 +2,17 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg arch=amd64] https://brave-browser-apt-beta.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-beta.list
# Install Brave Beta
apt update
apt install -y brave-browser-beta
# Add pre-installed extensions
sudo ln -s /opt/brave.com/brave/extensions /opt/brave.com/brave-beta/extensions
fi
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg arch=amd64] https://brave-browser-apt-beta.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-beta.list
# Install Brave Beta
apt update
apt install -y brave-browser-beta
# Add pre-installed extensions
sudo ln -s /opt/brave.com/brave/extensions /opt/brave.com/brave-beta/extensions

View file

@ -2,49 +2,49 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0" "$USER"
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
extensionName=youtube-music-dl
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
# Prepare extension
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
# 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
# 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
{
echo "{"
echo ' "external_crx": "'"$destination"'",'
echo ' "external_version": "'"$extensionVersion"'"'
echo "}"
} | tee $configRoot/$extensionID.json
fi
# 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
extensionName=youtube-music-dl
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
# Prepare extension
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
# 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
# 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
{
echo "{"
echo ' "external_crx": "'"$destination"'",'
echo ' "external_version": "'"$extensionVersion"'"'
echo "}"
} | tee $configRoot/$extensionID.json

View file

@ -2,17 +2,17 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-nightly-archive-keyring.gpg https://brave-browser-apt-nightly.s3.brave.com/brave-browser-nightly-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-nightly-archive-keyring.gpg arch=amd64] https://brave-browser-apt-nightly.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-nightly.list
# Install Brave Nightly
apt update
apt install -y brave-browser-nightly
# Add pre-installed extensions
sudo ln -s /opt/brave.com/brave/extensions /opt/brave.com/brave-nightly/extensions
fi
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-nightly-archive-keyring.gpg https://brave-browser-apt-nightly.s3.brave.com/brave-browser-nightly-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-nightly-archive-keyring.gpg arch=amd64] https://brave-browser-apt-nightly.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-nightly.list
# Install Brave Nightly
apt update
apt install -y brave-browser-nightly
# Add pre-installed extensions
sudo ln -s /opt/brave.com/brave/extensions /opt/brave.com/brave-nightly/extensions

View file

@ -2,14 +2,14 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | tee /etc/apt/sources.list.d/brave-browser-release.list
# Install Brave
apt update
apt install -y brave-browser
fi
# Prepare
apt install -y wget unzip jq apt-transport-https curl
curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | tee /etc/apt/sources.list.d/brave-browser-release.list
# Install Brave
apt update
apt install -y brave-browser

View file

@ -2,18 +2,18 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
apt install -y wget gpg
keyFile=$(mktemp)
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
| gpg --dearmor > $keyFile
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
fi
apt-get install -y wget gpg
keyFile=$(mktemp)
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
| gpg --dearmor > $keyFile
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

22
scripts/PopOS/software/codium.sh Normal file → Executable file
View file

@ -2,15 +2,15 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
| gpg --dearmor \
| dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' \
| tee /etc/apt/sources.list.d/vscodium.list
apt update
apt install -y codium
fi
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
| gpg --dearmor \
| dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' \
| tee /etc/apt/sources.list.d/vscodium.list
apt update
apt install -y codium

View file

@ -2,20 +2,20 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
commandName=gnome-shell-extension-installer
workingDirectory=$(pwd)
contextRoot=$(mktemp -d)
cd $contextRoot
wget -O $commandName "https://github.com/brunelli/gnome-shell-extension-installer/raw/master/gnome-shell-extension-installer"
install $commandName /usr/local/bin
cd $workingDirectory
rm -rf $contextRoot
gnome-shell-extension-installer 779 --yes
gnome-shell-extension-installer 4907 --yes
killall -SIGQUIT gnome-shell
fi
commandName=gnome-shell-extension-installer
workingDirectory=$(pwd)
contextRoot=$(mktemp -d)
cd $contextRoot
wget -O $commandName "https://github.com/brunelli/gnome-shell-extension-installer/raw/master/gnome-shell-extension-installer"
install $commandName /usr/local/bin
cd $workingDirectory
rm -rf $contextRoot
gnome-shell-extension-installer 779 --yes
gnome-shell-extension-installer 4907 --yes
killall -SIGQUIT gnome-shell

View file

@ -2,18 +2,18 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0" "$USER"
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
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 $homeDir/.bashrc
fi
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 ~')
{
echo "alias ls='logo-ls -D'"
echo "alias ll='ls -al'"
echo "alias l='ls'"
} | sudo -u $1 tee $homeDir/.bashrc

View file

@ -2,21 +2,21 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0" "$USER"
sudo bash "$BASH_SOURCE" "$USER"
else
bin=oh-my-posh
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
cd $workingDirectory
rm -rf $contextRoot
homeDir=$(sudo -u $1 bash -c 'realpath ~')
echo 'eval "$(oh-my-posh init bash --config ~/Nextcloud/.omp/manuel.omp.json)' \
| sudo -u $1 tee $homeDir/.bashrc
fi
bin=oh-my-posh
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
cd $workingDirectory
rm -rf $contextRoot
homeDir=$(sudo -u $1 bash -c 'realpath ~')
echo 'eval "$(oh-my-posh init bash --config ~/Nextcloud/.omp/manuel.omp.json)' \
| sudo -u $1 tee $homeDir/.bashrc

View file

@ -2,8 +2,8 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
apt install -y python3 python-is-python3 python3-pip
pip install pipenv
fi
apt install -y python3 python-is-python3 python3-pip
pip install pipenv

View file

@ -2,12 +2,12 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
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
cp ./rclone@.service /etc/systemd/user
fi
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 ./rclone@.service /etc/systemd/user

View file

@ -2,15 +2,15 @@
# Elevate script
if [ ! "$UID" -eq 0 ]
then
exec sudo bash "$0"
sudo bash "$BASH_SOURCE"
else
workingDirectory=$(pwd)
contextRoot=$(mktemp)
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
fi
workingDirectory=$(pwd)
contextRoot=$(mktemp)
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