blob: f659721b32e6ab720bf0bb4edfb54e3f46f72268 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#!/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 <<EOF
Usage:
setup.sh <TAR_PATH>
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 "${TAR_PATH}"
tar -xvf EuAndreh.tar
gpg --import keys.gpg
gpg --import-ownertrust trust.txt
rm "${TAR_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
|