Streamline installation of all further software
This commit is contained in:
parent
f1163a12c8
commit
719a9ab8ff
36 changed files with 679 additions and 9 deletions
scripts/Common/Software
Chromium
Virtual Machine Manager
aliae
brave
firefox
logo-ls
n
nix
nuke-usb
pyenv
rclone
vscode
59
scripts/Common/Software/Chromium/install-extension.sh
Normal file
59
scripts/Common/Software/Chromium/install-extension.sh
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
BROWSER_BIN="${BROWSER_BIN}";
|
||||
EXTENSION_NAME="${EXTENSION_NAME}";
|
||||
UNPACKED_EXTENSION="${UNPACKED_EXTENSION}";
|
||||
EXTENSION_DIR="${EXTENSION_DIR:-"/usr/local/share/chromium-extensions"}";
|
||||
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}";
|
||||
|
||||
# Elevate script
|
||||
if [ ! "$UID" -eq 0 ]
|
||||
then
|
||||
sudo \
|
||||
BROWSER_BIN="${BROWSER_BIN}" \
|
||||
EXTENSION_NAME="${EXTENSION_NAME}" \
|
||||
UNPACKED_EXTENSION="${UNPACKED_EXTENSION}" \
|
||||
EXTENSION_DIR="${EXTENSION_DIR}" \
|
||||
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
|
||||
bash "$BASH_SOURCE" "$USER";
|
||||
else
|
||||
keyFile="$UNPACKED_EXTENSION.pem";
|
||||
extensionFile="$UNPACKED_EXTENSION.crx";
|
||||
manifestFile="$UNPACKED_EXTENSION/manifest.json";
|
||||
|
||||
destination="$EXTENSION_DIR/$EXTENSION_NAME.crx";
|
||||
|
||||
sudo -u "$1" "${BROWSER_BIN}" --pack-extension="$UNPACKED_EXTENSION";
|
||||
|
||||
# Tamper manifest file
|
||||
manifest="$(cat "$manifestFile" | jq ". + {key: "'"'"$(openssl rsa -in "$keyFile" -pubout -outform DER | openssl base64 -A)"'"'"}")";
|
||||
echo "$manifest" | sudo -u "$1" tee "$manifestFile" > /dev/null;
|
||||
|
||||
# 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" "${BROWSER_BIN}" --pack-extension="$UNPACKED_EXTENSION" --pack-extension-key="$keyFile";
|
||||
|
||||
# Install extension and preinstall it
|
||||
mkdir -p "$EXTENSION_DIR";
|
||||
cp "$extensionFile" "$destination";
|
||||
chmod -R a+rx "$EXTENSION_DIR";
|
||||
chmod -R u+w "$EXTENSION_DIR";
|
||||
mkdir -p "$EXTENSION_POLICY_DIR";
|
||||
crxProperty="external_crx";
|
||||
|
||||
find "$EXTENSION_POLICY_DIR" -name "*.json" -print0 |
|
||||
while IFS= read -r -d "" file
|
||||
do
|
||||
if [ "$(cat "$file" | jq -r ".$crxProperty")" == "$destination" ]
|
||||
then
|
||||
rm "$file";
|
||||
fi;
|
||||
done;
|
||||
|
||||
{
|
||||
echo "{";
|
||||
echo ' "external_crx": "'"$destination"'",';
|
||||
echo ' "external_version": "'"$extensionVersion"'"';
|
||||
echo "}";
|
||||
} | tee "$EXTENSION_POLICY_DIR/$extensionID.json" > /dev/null;
|
||||
fi
|
33
scripts/Common/Software/Chromium/ytmdl.sh
Normal file
33
scripts/Common/Software/Chromium/ytmdl.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
|
||||
BROWSER_BIN="${BROWSER_BIN}";
|
||||
EXTENSION_DIR="${EXTENSION_DIR}";
|
||||
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}";
|
||||
|
||||
archiveName="$(mktemp)";
|
||||
extensionDir="$(mktemp -d)";
|
||||
manifestFile="$extensionDir/manifest.json";
|
||||
chmod a+rwx "$extensionDir";
|
||||
# Download `youtube-music-dl`
|
||||
wget https://github.com/dougppaz/youtube-music-dl/releases/download/v1.2.1/youtube-music-dl.zip -O "$archiveName";
|
||||
|
||||
# Prepare extension
|
||||
mkdir -p "$extensionDir";
|
||||
unzip "$archiveName" -d "$extensionDir";
|
||||
rm "$archiveName";
|
||||
|
||||
# Tamper manifest file
|
||||
manifest="$(cat "$manifestFile" | jq ".background.persistent = false")";
|
||||
echo "$manifest" > "$manifestFile";
|
||||
|
||||
BROWSER_BIN="${BROWSER_BIN}" \
|
||||
EXTENSION_NAME="youtube-music-dl" \
|
||||
UNPACKED_EXTENSION="$extensionDir" \
|
||||
EXTENSION_DIR="${EXTENSION_DIR}" \
|
||||
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
|
||||
. ./install-extension.sh;
|
||||
|
||||
rm -rf "$extensionDir";
|
||||
|
||||
popd > /dev/null;
|
18
scripts/Common/Software/Virtual Machine Manager/main.fish
Normal file
18
scripts/Common/Software/Virtual Machine Manager/main.fish
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function installSW
|
||||
end
|
||||
|
||||
function configureSW
|
||||
sudo virsh net-autostart default
|
||||
|
||||
if not sudo virsh net-info default | grep "^Active:\s*yes\$" > /dev/null
|
||||
sudo virsh net-start default || true
|
||||
end
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
|
@ -14,7 +14,11 @@ begin
|
|||
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
||||
|
||||
begin
|
||||
echo "export ALIAE_CONFIG=$(string escape "$file")"
|
||||
printf %s\n "" \
|
||||
"# aliae" \
|
||||
"export ALIAE_CONFIG=$(string escape "$file")" \
|
||||
'eval "$(aliae init bash)"' \
|
||||
'eval "$(aliae completion bash)"'
|
||||
end | installBashProfile "aliae" "aliae"
|
||||
|
||||
begin
|
||||
|
|
29
scripts/Common/Software/brave/main.fish
Normal file
29
scripts/Common/Software/brave/main.fish
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function configureSW
|
||||
set -l bin
|
||||
set -l extensionRoot
|
||||
set -l bins brave brave-beta brave-nightly
|
||||
|
||||
set -l \
|
||||
extensionRoots \
|
||||
/opt/brave-bin/extensions \
|
||||
/opt/brave.com/brave-{beta,nightly}/extensions
|
||||
|
||||
for i in (seq (count $bins))
|
||||
if type -q "$bins[$i]"
|
||||
set bin "$bins[$i]"
|
||||
set extensionRoot "$extensionRoots[$i]"
|
||||
end
|
||||
end
|
||||
|
||||
BROWSER_BIN="$bin" \
|
||||
EXTENSION_POLICY_DIR="$braveExtensions" \
|
||||
bash "$dir/../Chromium/ytmdl.sh"
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
7
scripts/Common/Software/firefox/firefox.sh
Executable file
7
scripts/Common/Software/firefox/firefox.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
if [ "$XDG_SESSION_TYPE" == "wayland" ]
|
||||
then
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
else
|
||||
export MOZ_USE_XINPUT2=1
|
||||
fi
|
12
scripts/Common/Software/firefox/main.fish
Normal file
12
scripts/Common/Software/firefox/main.fish
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
source "$dir/../../../Common/Software/firefox/main.fish"
|
||||
|
||||
function configureSW -V dir
|
||||
sudo cp "$dir/firefox.sh" /etc/profile.d/
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
59
scripts/Common/Software/logo-ls/main.fish
Normal file
59
scripts/Common/Software/logo-ls/main.fish
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function configureSW -V dir
|
||||
source "../bash/profile.fish";
|
||||
source "../fish/profile.fish";
|
||||
set -l functionName _PortValhalla_ls_
|
||||
|
||||
function dump_header
|
||||
echo "# logo-ls"
|
||||
end
|
||||
|
||||
function dump_aliases
|
||||
printf %s\n \
|
||||
"alias ls='$functionName'" \
|
||||
"alias ll='ls -al'" \
|
||||
"alias l='ls'"
|
||||
end
|
||||
|
||||
begin
|
||||
dump_header
|
||||
|
||||
printf %s\n \
|
||||
"function $functionName() {" \
|
||||
" if [ -t 1 ]" \
|
||||
" then" \
|
||||
' logo-ls -D "$@";' \
|
||||
" else" \
|
||||
' ls --color=auto "$@"' \
|
||||
" fi;" \
|
||||
"}" \
|
||||
""
|
||||
|
||||
dump_aliases
|
||||
end | installBashProfile "logo-ls"
|
||||
|
||||
if type -q fish
|
||||
begin
|
||||
dump_header
|
||||
|
||||
printf %s\n \
|
||||
"function $functionName" \
|
||||
" if [ -t 1 ]" \
|
||||
' logo-ls -D $argv' \
|
||||
" else" \
|
||||
' command ls --color=auto $argv' \
|
||||
" end" \
|
||||
"end" \
|
||||
""
|
||||
|
||||
dump_aliases
|
||||
end | installFishProfile "logo-ls"
|
||||
end
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
16
scripts/Common/Software/n/main.fish
Normal file
16
scripts/Common/Software/n/main.fish
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function installSW
|
||||
npm install --global n
|
||||
configureSW
|
||||
end
|
||||
|
||||
function configureSW
|
||||
n install latest
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
|
@ -8,6 +8,9 @@ begin
|
|||
set -l configFile ~/.config/nix/nix.conf
|
||||
mkdir -p (dirname "$configFile")
|
||||
cp "$dir/../../../../archiso/airootfs/root/.config/nix/nix.conf" "$configFile"
|
||||
else
|
||||
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||
sudo nix-channel --update
|
||||
end
|
||||
end
|
||||
|
||||
|
|
11
scripts/Common/Software/nuke-usb/main.fish
Normal file
11
scripts/Common/Software/nuke-usb/main.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function installSW -V dir
|
||||
sudo install -m 755 "$dir/nuke-usb.sh" /usr/local/bin/nuke-usb
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
29
scripts/Common/Software/pyenv/main.fish
Normal file
29
scripts/Common/Software/pyenv/main.fish
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
source "$dir/../../../Common/Software/aliae/main.fish"
|
||||
|
||||
function installSW
|
||||
curl https://pyenv.run | bash
|
||||
configureSW
|
||||
end
|
||||
|
||||
function configureSW
|
||||
source "$dir/../bash/profile.fish"
|
||||
source "$dir/../fish/profile.fish"
|
||||
|
||||
begin
|
||||
printf %s\n "" \
|
||||
'export PYENV_ROOT="$HOME/.pyenv"' \
|
||||
'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' \
|
||||
'eval "$(pyenv init -)"'
|
||||
end | installBashProfile "pyenv" > /dev/null
|
||||
|
||||
if type -q fish
|
||||
addFishProfile "pyenv" "pyenv" "pyenv init - | source"
|
||||
end
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
11
scripts/Common/Software/rclone/main.fish
Normal file
11
scripts/Common/Software/rclone/main.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
|
||||
function configureSW -V dir
|
||||
sudo cp "$dir/rclone.service" "$dir/rclone.target" "$dir/rclone@.service" /etc/systemd/user
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
10
scripts/Common/Software/rclone/rclone.service
Normal file
10
scripts/Common/Software/rclone/rclone.service
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=rclone Service Starter
|
||||
Documentation=man:rclone(1)
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=bash -c 'sleep 10; systemctl --user start rclone.target'
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
3
scripts/Common/Software/rclone/rclone.target
Normal file
3
scripts/Common/Software/rclone/rclone.target
Normal file
|
@ -0,0 +1,3 @@
|
|||
[Unit]
|
||||
Description=rclone Mounts
|
||||
Documentation=man:rclone(1)
|
35
scripts/Common/Software/rclone/rclone@.service
Normal file
35
scripts/Common/Software/rclone/rclone@.service
Normal file
|
@ -0,0 +1,35 @@
|
|||
[Unit]
|
||||
Description=rclone: Remote FUSE filesystem for cloud storage config %i
|
||||
Documentation=man:rclone(1)
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
Environment="EXPRESSION=%i"
|
||||
ExecStart= \
|
||||
bash -c ' \
|
||||
args=; \
|
||||
target="$(echo "$EXPRESSION" | cut -d":" -f1)"; \
|
||||
dirname="$(echo "$EXPRESSION" | cut -d":" -f2)"; \
|
||||
cacheDuration="$(echo "$EXPRESSION" | cut -d":" -f3)"; \
|
||||
\
|
||||
if [ ! -z "$cacheDuration" ]; \
|
||||
then \
|
||||
args="--vfs-cache-max-age=$cacheDuration"; \
|
||||
fi; \
|
||||
\
|
||||
destination="`cd "%h/.mnt"; realpath -m "$dirname"`"; \
|
||||
mkdir -p "$destination"; \
|
||||
mkdir -p /tmp/rclone; \
|
||||
/usr/bin/rclone mount \
|
||||
--config="%h/.config/rclone/rclone.conf" \
|
||||
--vfs-cache-mode full \
|
||||
--log-file /tmp/rclone/$target.log \
|
||||
$args \
|
||||
$target: "$destination";'
|
||||
ExecStop=bash -c '/bin/fusermount -zu "`cd "%h/.mnt"; realpath "$(echo "$EXPRESSION" | cut -d":" -f2)"`"'
|
||||
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=rclone.target
|
21
scripts/Common/Software/vscode/main.fish
Normal file
21
scripts/Common/Software/vscode/main.fish
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../../Scripts/software.fish"
|
||||
source "$dir/../../../Common/Software/aliae/main.fish"
|
||||
|
||||
function configureSW
|
||||
set -l bins codium codium-insiders code code-insiders
|
||||
set -l extensions zokugun.{sync-settings,vsix-manager}
|
||||
|
||||
for bin in $bins
|
||||
if type -q "$bin"
|
||||
for extension in $extensions
|
||||
"$bin" --install-extension "$extension"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue