Compare commits

..

3 Commits

Author SHA1 Message Date
21ffa34ed3 Fix script 2026-03-01 00:25:15 +00:00
cfc3e10ce0 Updating install script 2026-03-01 00:09:35 +00:00
f30008981b Add packages list to yazi 2026-02-28 19:01:11 +00:00
11 changed files with 253 additions and 0 deletions

22
.config/yazi/package.toml Normal file
View File

@@ -0,0 +1,22 @@
[[plugin.deps]]
use = "yazi-rs/plugins:git"
rev = "1962818"
hash = "26db011a778f261d730d4f5f8bf24b3f"
[[plugin.deps]]
use = "dedukun/bookmarks"
rev = "9ef1254"
hash = "92fbb5483657fa7976cdf4e0104e18e0"
[[plugin.deps]]
use = "dedukun/relative-motions"
rev = "a603d9e"
hash = "e02a788e5b8ae0fb47fd0193dda589cc"
[[plugin.deps]]
use = "yazi-rs/plugins:smart-filter"
rev = "1962818"
hash = "c887903a63a2ff520081b6d90a4b3392"
[flavor]
deps = []

15
.local/bin/install/dev.sh Executable file
View File

@@ -0,0 +1,15 @@
#! bash
echo "Creating development directories"
mkdir "$HOME/Code"
mkdir "$HOME/Code/DevOps" # For server and computer admin
mkdir "$HOME/Code/FSharp"
mkdir "$HOME/Code/JavaScript"
mkdir "$HOME/Code/Scala"
mkdir "$HOME/Code/Rust"
mkdir "$HOME/Code/PHP"
mkdir "$HOME/Code/Tutorials" # For doing tutorials/courses
mkdir "$HOME/Code/Sites" # Websites in any language
mkdir "$HOME/Code/MobileApps" # Mobile apps in any language
mkdir "$HOME/Code/Tests" # Small test files/scripts

20
.local/bin/install/firefox.sh Executable file
View File

@@ -0,0 +1,20 @@
#! zsh
FIREFOX=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Firefox" 2>&1)
FIREFOXUN=$(echo "$FIREFOX" | grep -Po "(?<=login: )\w+")
wait_for_copy() {
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
}
echo $FIREFOXUN | wl-copy
firefox "https://accounts.firefox.com/signin?action=email&service=sync" &
wait_for_copy()
enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Firefox"
read -s -k $'?Press enter when you have synced Firefox...\n'
echo "" | wl-copy

7
.local/bin/install/install.sh Executable file
View File

@@ -0,0 +1,7 @@
#! bash
"$HOME/.local/bin/install/password.sh"
"$HOME/.local/bin/install/ssh.sh"
"$HOME/.local/bin/install/dev.sh"
"$HOME/.local/bin/install/firefox.sh"
"$HOME/.local/bin/install/nextcloud.sh"

25
.local/bin/install/nextcloud.sh Executable file
View File

@@ -0,0 +1,25 @@
#! zsh
# 1. Fetch credentials (Enpass logic remains the same)
TOWER=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Tower" 2>&1)
TOWERUN=$(echo "$TOWER" | grep -Po "(?<=login: )\w+")
wait_for_copy() {
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
}
echo "https://tower.scarif.space" | wl-copy
mkdir -p "$HOME/Tower"
nextcloud &
wait_for_copy
echo "$TOWERUN" | wl-copy
wait_for_copy
enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Scarif: Tower"
read -s -k $'?Press enter when you have synced Nextcloud... \n'
wl-copy --clear

View File

@@ -0,0 +1,8 @@
#! /bin/bash
doas tee /etc/udev/rules/90-backlight.rules <<HRD
SUBSYSTEM=="backlight", ACTION=="add" \
RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness", \
RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
HRD

View File

@@ -0,0 +1,14 @@
#! /bin/bash
sudo pacman --noconfirm --needed -S python-pyqt5 hplip nss-mdns
sudo sed -i 's/hosts: files mymachines myhostname resolve [!UNAVAIL=return] dns/hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns/' /etc/nsswitch.conf
sudo systemctl enable --now avahi-daemon
hp-setup -i 192.168.2.77
lpoptions -d DeskJet_3700
lpoptions -o PageSize=A4

View File

@@ -0,0 +1,18 @@
#! /bin/bash
doas tee /etc/NetworkManager/conf.d <<HRD
[main]
dhcpd=dhclient
HRD
doas tee /etc/iwd/main.conf <<HRD
[Network]
EnableNetworkConfiguration=True
EnableIPv6=True
HRD
doas systemctl enable --now iwd
doas systemctl enable --now NetworkManager
nmtui

29
.local/bin/install/password.sh Executable file
View File

@@ -0,0 +1,29 @@
#! bash
export MASTERPW=$(gum input --header="Master password" --password)
echo "https://tower.scarif.space" | wl-copy
wait_for_copy() {
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
}
Enpass &
wait_for_copy
echo "$MASTERPW" | wl-copy
read -n 1 -r -s -p $'Press enter when you have synced enpass...\n'
echo "" | wl-copy
CHECKPW=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort list 2>&1)
while [[ "$CHECKPW" == *level=fatal* ]]; do
export MASTERPW=$(zenity --password)
CHECKPW=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort list)
done
echo "Password set successfuly"

78
.local/bin/install/ssh.sh Executable file
View File

@@ -0,0 +1,78 @@
#! bash
echo "Setting up SSH"
# Extract the login details from enpass
LABS=$(enpass-cli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Labs" 2>&1)
LABSUN=$(echo "$LABS" | grep -Po "(?<=login: )\w+")
LABSPW=$(enpass-cli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort pass "Scarif: Labs")
SSHPATH="$HOME/.ssh/id_ed25519" # The path to the SSH key file
TITLE="$USER@$(cat /etc/hostname)" # The title for the SSH key
echo "Generate the SSH key if it does not exist"
[ ! -f $SSHPATH ] && ssh-keygen -t ed25519 -f "$SSHPATH" -N "" -q
KEY=$(cat "$SSHPATH.pub")
# A method to generate the parameters for creating an SSH key on gitea
generate_post_data() {
cat <<EOF
{
"key": "$KEY",
"read_only": false,
"title": "$TITLE"
}
EOF
}
CREDENTIALS="$LABSUN:$LABSPW" # The credentials to pass to the API
KEYS_URL="https://$CREDENTIALS@labs.scarif.space/api/v1/user/keys"
# Get all the existing keys
KEYS=$(curl -X GET -s -S --url "$KEYS_URL")
KEY_EXISTS=$(echo $KEYS | jq --arg TITLE "$TITLE" 'map(.title|ascii_downcase)|contains([$TITLE|ascii_downcase])')
if [[ $KEY_EXISTS == true ]]; then
echo "Found keys with the same title as this machine."
# Extract the ids of the keys with the same title as this machine
IDS=$(echo "$KEYS" | jq --arg TITLE "$TITLE" 'map(select(.title|ascii_downcase == ($TITLE|ascii_downcase)))[].id')
# Loop through the keys and remove them from gitea to be replaced by the new one
echo "Removing found keys to replace with this machine"
if [ ! -z "$IDS" ]; then
for ID in $IDS; do
echo "Deleting key with ID $ID"
curl -X DELETE \
-s -S \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
--url "$KEYS_URL/$ID"
done
fi
fi
echo "Saving the new key"
curl -X POST \
-s -S \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
--data "$(generate_post_data)" \
--url "$KEYS_URL"
HTTP_REPLACE="s/https:\/\/labs\.scarif\.space\//git@labs.scarif.space:/"
# for dir in $(ls "$HOME/.local/src"); do
# dir="$HOME/.local/src/$dir"
# if [ -d $dir ]; then
# cd "$dir"
# SSH_URL=$(git remote get-url origin | sed "$HTTP_REPLACE")
# git remote set-url origin "$SSH_URL"
# fi
# done
echo "Replacing remote URL to use SSH key"
DOTFILES_SSH_URL=$(git --git-dir "$HOME/.config/dotfiles/.git" --work-tree="$HOME" remote get-url origin | sed "$HTTP_REPLACE")
git --git-dir "$HOME/.config/dotfiles/.git" --work-tree="$HOME" remote set-url origin "$DOTFILES_SSH_URL"

17
.local/bin/install/vpn.sh Executable file
View File

@@ -0,0 +1,17 @@
#! bash
sudo systemctl enable --now expressvpn.service
VPN=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "ExpressVPN Activation Code" 2>&1)
VPNPW=$(echo "$LABS" | grep -Po "(?<=pass : ).+(?=\")")
echo "$VPNPW" | xclip -selection clipboard -i
expressvpn activate
expressvpn autoconnect true
expressvpn connect smart
echo "" | xclip -selection clipboard -i