Compare commits
5 Commits
41f219ddee
...
23bbbbdbe8
| Author | SHA1 | Date | |
|---|---|---|---|
| 23bbbbdbe8 | |||
| 3f5b212d37 | |||
| dbeb4d02a4 | |||
| 673748402a | |||
| 605b30c730 |
@@ -1,6 +1,6 @@
|
||||
exec-once = uwsm-app -- hypridle
|
||||
exec-once = uwsm-app -- mako
|
||||
exec-once = uwsm-app -- waybar
|
||||
# exec-once = uwsm-app -- waybar
|
||||
exec-once = uwsm-app -- fcitx5 --disable notificationitem
|
||||
exec-once = uwsm-app -- swaybg -i ~/.config/station/current/background -m fill
|
||||
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||
|
||||
@@ -36,7 +36,7 @@ alias eff='$EDITOR "$(ff)"'
|
||||
|
||||
if command -v eza &> /dev/null; then
|
||||
alias ls='eza -lh --group-directories-first --icons=auto'
|
||||
alias lsa='ls -a'
|
||||
alias la='ls -al'
|
||||
alias lt='eza --tree --level=2 --long --icons --git'
|
||||
alias lta='lt -a'
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "Let's get set up"
|
||||
echo """
|
||||
|
||||
░▒█▀▀▀█░▀▀█▀▀░█▀▀▄░▀▀█▀▀░▀█▀░▒█▀▀▀█░▒█▄░▒█░░░▒█▀▀▀█░▒█▀▀▀░▀▀█▀▀░▒█░▒█░▒█▀▀█
|
||||
░░▀▀▀▄▄░░▒█░░▒█▄▄█░░▒█░░░▒█░░▒█░░▒█░▒█▒█▒█░░░░▀▀▀▄▄░▒█▀▀▀░░▒█░░░▒█░▒█░▒█▄▄█
|
||||
░▒█▄▄▄█░░▒█░░▒█░▒█░░▒█░░░▄█▄░▒█▄▄▄█░▒█░░▀█░░░▒█▄▄▄█░▒█▄▄▄░░▒█░░░░▀▄▄▀░▒█░░░
|
||||
|
||||
"""
|
||||
|
||||
"$HOME/.local/bin/install/password.sh"
|
||||
"$HOME/.local/bin/install/password-manager.sh"
|
||||
"$HOME/.local/bin/install/ssh.sh"
|
||||
"$HOME/.local/bin/install/dev.sh"
|
||||
"$HOME/.local/bin/install/server.sh"
|
||||
"$HOME/.local/bin/install/firefox.sh"
|
||||
"$HOME/.local/bin/install/nextcloud.sh"
|
||||
|
||||
41
.local/bin/station-install/password-manager.sh
Executable file
41
.local/bin/station-install/password-manager.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "-------------------------------------"
|
||||
echo "Enpass Setup Script"
|
||||
echo "-------------------------------------"
|
||||
|
||||
export MASTERPW=$(gum input --header="Enpass Master password" --password)
|
||||
|
||||
echo "stofflees@gmail.com" | wl-copy
|
||||
|
||||
station-launch-password-manager
|
||||
|
||||
zenity --title="Enpass Setup" \
|
||||
--info \
|
||||
--text="Email copied.\nPress OK when it asks for webdav URL" \
|
||||
|| gum confirm "You closed the dialog, do you want to continue?" \
|
||||
|| exit 1
|
||||
|
||||
echo "https://tower.scarif.space" | wl-copy
|
||||
|
||||
zenity --title="Enpass Setup" \
|
||||
--info \
|
||||
--text="Tower URL copied.\nPress OK when it asks for master password" \
|
||||
|| gum confirm "You closed the dialog, do you want to continue?" \
|
||||
|| exit 1
|
||||
|
||||
echo "$MASTERPW" | wl-copy
|
||||
|
||||
read -n 1 -r -s -p $'Press enter when you have synced enpass...\n'
|
||||
|
||||
wl-copy --clear
|
||||
|
||||
CHECKPW=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -sort list 2>&1)
|
||||
|
||||
while [[ "$CHECKPW" == *level=fatal* ]]; do
|
||||
export MASTERPW=$(gum input --header="Enpass Master password (incorrect, try again)" --password")
|
||||
CHECKPW=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -sort list)
|
||||
done
|
||||
|
||||
echo "Password set successfuly"
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
#! /bin/bash
|
||||
|
||||
export MASTERPW=$(gum input --header="Master password" --password)
|
||||
echo "-------------------------------------"
|
||||
echo "Password Setup Script"
|
||||
echo "-------------------------------------"
|
||||
|
||||
Enpass &
|
||||
if gum confirm "Do you need to change your password?"; then
|
||||
while true; do
|
||||
if passwd; then
|
||||
echo "Password successfully updated."
|
||||
break
|
||||
else
|
||||
echo "Failed to update password."
|
||||
|
||||
echo "$MASTERPW" | wl-copy
|
||||
|
||||
read -n 1 -r -s -p $'Press enter when you have synced enpass...\n'
|
||||
|
||||
wl-copy --clear
|
||||
|
||||
CHECKPW=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -sort list 2>&1)
|
||||
|
||||
while [[ "$CHECKPW" == *level=fatal* ]]; do
|
||||
export MASTERPW=$(zenity --password)
|
||||
CHECKPW=$(enpass-cli -vault="$HOME/.local/share/Enpass/Enpass/Vaults/primary" -sort list)
|
||||
if ! gum confirm "Would you like to try again?"; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Password set successfuly"
|
||||
|
||||
else
|
||||
echo "Password change skipped."
|
||||
fi
|
||||
|
||||
84
.local/bin/station-install/server.sh
Executable file
84
.local/bin/station-install/server.sh
Executable file
@@ -0,0 +1,84 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "-------------------------------------"
|
||||
echo "Server Setup Script"
|
||||
echo "-------------------------------------"
|
||||
|
||||
echo "Extracting login details from enpass"
|
||||
SCARIF=$(enpass-cli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif space" 2>&1)
|
||||
LABSUN=$(echo "$LABS" | grep -Po "(?<=Admin 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 "---"
|
||||
echo "Generating 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])')
|
||||
|
||||
echo "~~~~~~~~"
|
||||
echo "Checking if the key exists on the server"
|
||||
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 "---"
|
||||
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 "$HOME/.local/nixos"; 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"
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "Setting up SSH"
|
||||
echo "-------------------------------------"
|
||||
echo "SSH Setup Script"
|
||||
echo "-------------------------------------"
|
||||
|
||||
# Extract the login details from enpass
|
||||
echo "Extracting 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")
|
||||
@@ -10,7 +12,8 @@ LABSPW=$(enpass-cli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort pass "S
|
||||
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"
|
||||
echo "~~~~~~~~"
|
||||
echo "Generating the SSH key if it does not exist"
|
||||
[ ! -f $SSHPATH ] && ssh-keygen -t ed25519 -f "$SSHPATH" -N "" -q
|
||||
|
||||
KEY=$(cat "$SSHPATH.pub")
|
||||
@@ -34,6 +37,8 @@ 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])')
|
||||
|
||||
echo "~~~~~~~~"
|
||||
echo "Checking if the key exists on the server"
|
||||
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
|
||||
@@ -53,6 +58,7 @@ if [[ $KEY_EXISTS == true ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "~~~~~~~~"
|
||||
echo "Saving the new key"
|
||||
curl -X POST \
|
||||
-s -S \
|
||||
@@ -72,6 +78,7 @@ for dir in "$HOME/.local/nixos"; do
|
||||
fi
|
||||
done
|
||||
|
||||
echo "~~~~~~~~"
|
||||
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"
|
||||
|
||||
7
.local/bin/station-launch-password-manager
Executable file
7
.local/bin/station-launch-password-manager
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Launch the default password manager
|
||||
default_password_manager="enpass.desktop"
|
||||
password_manager_exec=$(sed -n 's/^Exec=\(.\+\?\)\( %U\)/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_password_manager 2>/dev/null | head -1)
|
||||
|
||||
$password_manager_exec "$@" >/dev/null 2>&1 &
|
||||
Reference in New Issue
Block a user