summaryrefslogtreecommitdiff
path: root/init
blob: 3d6b6b393e8fbdd6d9f4b5684b8a92d77b3f469a (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
#!/bin/sh

# 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 | sh



welcome () {
    clear
    echo "ArchSetup"
    echo "---------"
    echo ""
    echo ""
}

setup_ssh () {
    systemctl start sshd

    echo "root:welcome" | chpasswd
    hostname=$(</etc/hostname)
    ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)

    echo ""; echo ""; echo "init complete. "
    echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'"
}

############ SCRIPT

echo "Choose:"
echo " (1) install the arch linux base system"
echo " (2) setup the base system as a workstation"
echo " (3) allow ssh to this live iso"
echo " (Enter 1, 2, or 3) :"
read setup

if [ "$setup" = "arch" ]; then
    # run the arch setup script
    echo 

elif [ "$setup" = "ssh" ]; then
    setup_ssh #function above
elif [ "$setup" = "ssh" ]; then
else
    echo "Error: Unknown setup option. Please enter 'arch' or 'ssh'."
    exit 1
fi