aboutsummaryrefslogtreecommitdiff
path: root/public/nixos
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-06-01 23:16:40 -0300
committerEuAndreh <eu@euandre.org>2019-06-01 23:16:40 -0300
commitc88354a1442243c2da2438cf139f71bdea40be16 (patch)
treec82d533912ace2eed65617f3db7b182554df6ba7 /public/nixos
parentRemove extra GPG exporting info from README.org (diff)
downloaddotfiles-c88354a1442243c2da2438cf139f71bdea40be16.tar.gz
dotfiles-c88354a1442243c2da2438cf139f71bdea40be16.tar.xz
Add usage and import_gpg to setup.sh
Diffstat (limited to 'public/nixos')
-rw-r--r--public/nixos/setup.sh82
1 files changed, 63 insertions, 19 deletions
diff --git a/public/nixos/setup.sh b/public/nixos/setup.sh
index cfa88b5..50ea2b1 100644
--- a/public/nixos/setup.sh
+++ b/public/nixos/setup.sh
@@ -3,6 +3,69 @@
# 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 "${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."
+}
+
+import_gpg
+
# import GPG key pair
# download git annex from Nextcloud
# wait for Nextcloud to finish sync
@@ -20,25 +83,6 @@ set -Eeuo pipefail
# sudo create symlink for /etc/nixos/configuration.nix and /etc/nixos/local-configuration.nix
-# *** 4. Import GPG keys in new OS
-# #+BEGIN_SRC shell
-# gpg -o private -d private.gpg
-# gpg --import public.gpg
-# gpg --import private
-# gpg --edit-key EuAndreh
-
-# # Inside GPG prompt
-# trust
-# 5
-# quit
-
-# # end of GPG prompt
-# shred private
-# shred private.gpg
-# rm private
-# rm private.gpg
-# rm public.gpg
-# #+END_SRC
# *** 5. Clone annex repo from HD and setup remotes
# #+BEGIN_SRC shell
# git clone gcrypt::/media/andreh/UTCLOUD/annex.git