summaryrefslogtreecommitdiff
path: root/install-itzks-workstation-network-only
blob: 46b0f435df9ea6e1b3f72f4286f79964f3eba10c (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
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# script for installing a Debian Edu Workstation with ITZkS modifications

set -e

# FIXME: this should be scripted; manage with puppet instead
read -p '''!   Änderung in Network-Interfaces
Ändere die bestehenden Einträge für eth0 auf

   #NetworkManager iface eth0 inet dhcp

Starte nun den Editor mit [Enter]
'''
editor /etc/network/interfaces

####################

# FIXME: this should be scripted; manage with puppet instead
read -p '''!   Änderung in NFS-Common
Ändere die Datei /etc/default/nfs-common am Ende:
   NEED_GSSD= (leer lassen)
Starte nun den Editor mit [Enter]
'''
editor /etc/default/nfs-common

# Alternate: scripted edit to /etc/default/nfs-common when script is run
# sed -i 's/NEED_GSSD=.*/NEED_GSSD=/' /etc/default/nfs-common

####################

# Add system-wide WiFi-config
# echo '!   WIFI-Netzwerk hinzufügen'
# read -p 'Wie lautet die SSID? ' ssid
# read -p 'Wie lautet das zugehörige Passwort? ' passw
# export WIFIDEV=wlan0
# wpa_passphrase $ssid $passw >> /etc/wpa_supplicant/wpa_supplicant-$WIFIDEV.conf

# Alternate: Check for WiFi-Interface before asking for SSID and PW

#FOUND=`iwconfig | grep "IEE 802.11"`
#WIFIDEV=$(echo "$FOUND" | awk '{print $1}')

# FIXME: this works for systemd-networkd, but not for NetworkManager
#if  [ -n "$FOUND" ]; then
#	export WIFIDEV
#	# Add system-wide WiFi-config
#	echo '!   WIFI-Netzwerk hinzufügen'
#	read -p 'Wie lautet die SSID? ' ssid
#	read -p 'Wie lautet das zugehörige Passwort? ' passw
#	wpa_passphrase $ssid $passw >> /etc/wpa_supplicant/wpa_supplicant-$WIFIDEV.conf
#fi

# Alternate WiFi-config for NetworkManager

# Write standard config
touch /etc/NetworkManager/system-connections/BLANK
cat <<EOT >> /etc/NetworkManager/system-connections/BLANK
[connection]
id=<SSID>
uuid=42d084e4-4ff0-45a0-8aee-771c7a568046
type=wifi
permissions=
timestamp=1515144490
autoconnect=true

[wifi]
mac-address-blacklist=
mode=infrastructure
ssid=<SSID>

[wifi-security]
key-mgmt=wpa-psk
psk=<password>

[ipv4]
dns-search=
method=auto
ignore-auto-routes=false
ignore-auto-dns=false
never-default=false

[ipv6]
method=ignore
EOT

# Generate uuid and timestamp and overwrite in file

UUID=$(uuidgen -t wlan0)
sed -i 's/uuid=.*/uuid='"$UUID"'/' /etc/NetworkManager/system-connections/BLANK

TIMESTAMP=$(date +%s )
sed -i 's/timestamp=.*/timestamp='"$TIMESTAMP"'/' /etc/NetworkManager/system-connections/BLANK

# Ask user for SSID and password
echo '!   WIFI-Netzwerk hinzufügen'
read -p 'Wie lautet die SSID? ' ssid
sed -i 's/ssid=.*/ssid='"$ssid"'/' /etc/NetworkManager/system-connections/BLANK
sed -i 's/id=<SSID>/id='"$ssid"'/' /etc/NetworkManager/system-connections/BLANK
read -p 'Wie lautet das zugehörige Passwort? ' passw
sed -i 's/psk=.*/psk='"$passw"'/' /etc/NetworkManager/system-connections/BLANK
mv /etc/NetworkManager/system-connections/BLANK /etc/NetworkManager/system-connections/"$ssid"

# Set permissions on generated file
chmod go-rwx /etc/NetworkManager/systems-connections/"$ssid"