Files
dotfiles/.local/bin/setup/setupnextcloud

37 lines
1.2 KiB
Plaintext
Raw Normal View History

2026-02-22 23:22:56 +00:00
#!/usr/bin/zsh
2021-04-21 22:13:19 +01:00
2026-02-22 23:22:56 +00:00
# 1. Fetch credentials (Enpass logic remains the same)
2021-04-21 22:13:19 +01:00
TOWER=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Tower" 2>&1)
TOWERUN=$(echo "$TOWER" | grep -Po "(?<=login: )\w+")
2021-05-03 15:18:41 +01:00
2026-02-22 23:22:56 +00:00
# Helper function to wait for a clipboard change
wait_for_copy() {
# We use wl-paste --watch but kill it after the first event
# This mimics the 'clipnotify' behavior of pausing the script
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
}
2021-06-10 22:53:56 +01:00
2026-02-22 23:22:56 +00:00
# 2. Start the process
echo "https://tower.scarif.space" | wl-copy
2021-06-10 22:53:56 +01:00
mkdir -p "$HOME/Tower"
2026-02-22 23:22:56 +00:00
# Launch Nextcloud (Standard NixOS/Wayland path)
2021-06-10 22:53:56 +01:00
nextcloud &
2026-02-22 23:22:56 +00:00
# 3. The Sequence
# Wait for you to paste the URL, then copy the username
wait_for_copy
echo "$TOWERUN" | wl-copy
2021-06-10 22:53:56 +01:00
2026-02-22 23:22:56 +00:00
# Wait for you to paste the username, then copy the password
wait_for_copy
enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Scarif: Tower"
2021-06-10 22:53:56 +01:00
2026-02-22 23:22:56 +00:00
# 4. Finalize
2021-06-10 22:53:56 +01:00
read -s -k $'?Press enter when you have synced Nextcloud... \n'
2026-02-22 23:22:56 +00:00
# Clear clipboard for security
wl-copy --clear
2021-08-17 23:29:04 +01:00
2026-02-22 23:22:56 +00:00
# Symbolic links (NixOS usually manages fonts via config, but manual links still work)
ln -s "$HOME/Tower/Library/Pictures/Wallpapers/7680x2160" "$HOME/.local/share/wallpapers"