diff options
author | EuAndreh <eu@euandre.org> | 2019-06-02 01:17:07 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-06-02 01:17:07 -0300 |
commit | 4ec36c219d568bd9c3fab736ce465b0cdbf1b4ab (patch) | |
tree | c07a1ff1be924993721bfd10f3160a1b41804bcd /public/nixos/setup.sh | |
parent | Fix references from $KEY_PAIR_PATH to $TAR_PATH (diff) | |
download | dotfiles-4ec36c219d568bd9c3fab736ce465b0cdbf1b4ab.tar.gz dotfiles-4ec36c219d568bd9c3fab736ce465b0cdbf1b4ab.tar.xz |
WIP: add 3 extra steps to setup.sh
Add setup_git_annex, setup_dotfiles and restore_backups.
Diffstat (limited to 'public/nixos/setup.sh')
-rwxr-xr-x | public/nixos/setup.sh | 96 |
1 files changed, 70 insertions, 26 deletions
diff --git a/public/nixos/setup.sh b/public/nixos/setup.sh index f659721..64962fd 100755 --- a/public/nixos/setup.sh +++ b/public/nixos/setup.sh @@ -79,32 +79,76 @@ start_nextcloud() { green "Done." } +configure_git_annex() { + yellow "Setting up Git Annex repository..." + git clone "gcrypt::$HOME/Nextcloud/annex.git" "$HOME/annex/" + pushd ~/annex/ + read -r -p "What's the description of the local Git Annex repository? " DESCRIPTION + git config --global user.email "eu@euandre.org" + git config --global user.name "EuAndreh" + git annex describe here "${DESCRIPTION}" + + git annex enableremote nextcloud + git annex enableremote s3 + # FIXME: rsyncnet + # git annex enableremote hd + # gitlab + # rsyncnet + + git annex upgrade + git annex sync + popd + green "Done." +} + +configure_dotfiles() { + yellow "Setting up temporary SSH configuration and dotfiles repository..." + mkdir -p ~/.ssh + cp ~/annex/secret/SSH/id_rsa.pub.txt ~/.ssh/id_rsa.pub + cp ~/annex/secret/SSH/id_rsa.txt ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + blue "Open up the password manager to decrypt the SSH private key" + read -p "A prompt for the SSH password will appear! (Press any key to continue)" -n 1 -r + + # FIXME: Is there an easier way? + export SSH_ENV="$HOME/.ssh/environment" + echo "Initialising new SSH agent..." + ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" + echo succeeded + chmod 600 "${SSH_ENV}" + . "${SSH_ENV}" > /dev/null + ssh-add + # FIXME: Is there an easier way? + + mkdir -p ~/dev/libre/ + git clone git@git.sr.ht:~euandreh/dotfiles ~/dev/libre/dotfiles/ + pushd ~/dev/libre/dotfiles/ + git crypt unlock + popd + pushd ~/ + source ~/dev/libre/dotfiles/bash/bashrc.sh + popd + + read -p "A prompt for the sudo password password will appear for the NixOS symlinks! (Press any key to continue)" -n 1 -r + sudo ln -fs ~/dev/libre/dotfiles/nixos/configuration.nix /etc/nixos/configuration.nix + # sudo create symlink for /etc/nixos/configuration.nix and /etc/nixos/local-configuration.nix + green "Done." +} + +restore_backups() { + # rsync + # borg serve + + # restore mbsync from backup + # restore notmuch from backup + # restore newsboat from backup + # restore archive from backup +} + import_gpg start_nextcloud +setup_git_annex +setup_dotfiles +restore_backups -# 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 +green "All done!" |