#!/usr/bin/env nix-shell #!nix-shell -i bash -p bash # shellcheck shell=bash set -Eeuo pipefail end="\033[0m" green() { green_color="\033[0;32m" echo -e "${green_color}${1}${end}" } yellow() { yellow_color="\033[0;33m" echo -e "${yellow_color}${1}${end}" } blue() { blue_color="\033[0;34m" echo -e "${blue_color}${1}${end}" } red() { red_color="\033[0;31m" echo -e "${red_color}${1}${end}" } usage() { red "Missing input argument $1.\n" cat < Arguments TAR_PATH Path to the encrypted tar file with key pair and ownertrust information. Examples: Download setup.sh and run it local './EuAndreh.tar.gpg' key pair: curl https://euandre.org/dotfiles/nixos/setup.sh | bash -s ./EuAndreh.tar.gpg EOF } TAR_PATH="${1:-}" [[ -z "${TAR_PATH}" ]] && { usage 'TAR_PATH' exit 2 } import_gpg() { yellow "Import GPG data..." gpg -o EuAndreh.tar -d "${KEY_PAIR_PATH}" tar -xvf EuAndreh.tar gpg --import keys.gpg gpg --import-ownertrust trust.txt rm "${KEY_PAIR_PATH}" shred trust.txt rm trust.txt shred keys.gpg rm keys.gpg shred EuAndreh.tar rm EuAndreh.tar green "Done." } start_nextcloud() { yellow "Starting Nextcloud process and leaving it on the background..." nextcloud &> /dev/null & disown green "Done." yellow "Waiting for Nextcloud Git Annex repo to become available..." while true; do read -r -p "Has Nextcloud finished syncing? (Type uppercase sync): " sync [ "$sync" = 'SYNC' ] && break red "Please try again." done green "Done." } import_gpg start_nextcloud # download git annex from Nextcloud # wait for Nextcloud to finish sync # git annex enable # git annex describe # get annex & # download dotfiles # mr checkout & # wait # restore mbsync from backup # restore notmuch from backup # restore newsboat from backup # restore archive from backup # open emacs # eval x # sudo create symlink for /etc/nixos/configuration.nix and /etc/nixos/local-configuration.nix # *** 5. Clone annex repo from HD and setup remotes # #+BEGIN_SRC shell # git clone gcrypt::/media/andreh/UTCLOUD/annex.git # cd annex # git annex describe here "repo description" # git annex enableremote hd # git annex enableremote gitlab # git annex enableremote rsyncnet # git annex enableremote s3 # #+END_SRC