blob: 8d44b4919f7c5c2eef0a083cf2235e39bbc71e85 (
plain)
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
|
#!/usr/bin/env bash
# init
# Craig Jennings <c@cjennings.net>
# An archsetup script to welcome user, present options, and setup ssh
# server from the live cd. Functions to installing base arch and setup
# the workstation occur in other scripts, called by this script.
# Run as root after booting the live cd and issuing the following command:
# curl -s https://cjennings.net/archsetup/init | bash -i
welcome () {
clear
echo ""
echo "ArchSetup"
echo "---------"
echo ""
echo ""
}
check_root_or_exit () {
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
}
setup_ssh () {
# retrieve keys from repo and decrypt
echo "retrieving keys for decryption..."
{
mkdir -p "$HOME/.ssh/"
# retrieve keys from dotfiles repo and decrypt the keys
(git clone --depth 1 https://git.cjennings.net/dotfiles.git \
"$HOME/dotfiles/") >> /dev/null
cp "$HOME/dotfiles/system/.ssh/*" "$HOME/.ssh/"
rm -rf "$HOME/dotfiles/"
} > /dev/null
cd "$HOME/.ssh/"
gpg --decrypt "$HOME/ssh.tar.gz.gpg" | tar -zxf -
# set proper permissions on .ssh directory
cd "$HOME" && chmod 600 $HOME/.ssh/* && chmod 700 $HOME/.ssh \
&& chmod 644 $HOME/.ssh/*.pub
# setup ssh
echo "setting up ssh daemon..."
systemctl start sshd
echo "root:welcome" | chpasswd
hostname=$(</etc/hostname)
ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
# notify user
echo ""; echo ""
echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'"
}
############ SCRIPT
check_root_or_exit
# present menu
echo "Choose:"
echo " (1) create an arch linux base install"
echo " (2) turn a base install into a full workstation"
echo " (3) generate a workstation in an arch distrobox container"
echo " (4) allow ssh to this live iso"
echo " (Enter 1, 2, 3, or 4) :"
IFS= read -r setup
# read setup
echo "You chose '$SETUP'."
case $setup in
1)
echo "this will call the archinstall script"
;;
2)
echo "this will call the archsetup script"
;;
3)
echo "this will call the archsetup-distrobox script"
;;
4)
setup_ssh
;;
*)
echo "Error: Unknown setup option. Please enter 1,2,3,or 4."
exit 1
;;
esac
|