|
@@ -88,6 +88,9 @@ DEBIAN_VERSION="jessie"
|
88
|
88
|
# Directory where source code is downloaded and compiled
|
89
|
89
|
INSTALL_DIR=/root/build
|
90
|
90
|
|
|
91
|
+# device name for an attached usb drive
|
|
92
|
+USB_DRIVE=/dev/sda1
|
|
93
|
+
|
91
|
94
|
export DEBIAN_FRONTEND=noninteractive
|
92
|
95
|
|
93
|
96
|
# File which keeps track of what has already been installed
|
|
@@ -140,6 +143,37 @@ function change_login_message {
|
140
|
143
|
echo 'change_login_message' >> $COMPLETION_FILE
|
141
|
144
|
}
|
142
|
145
|
|
|
146
|
+function search_for_attached_usb_drive {
|
|
147
|
+ # If a USB drive is attached then search for email,
|
|
148
|
+ # gpg and ssh keys and change the directories accordingly
|
|
149
|
+ if grep -Fxq "search_for_attached_usb_drive" $COMPLETION_FILE; then
|
|
150
|
+ return
|
|
151
|
+ fi
|
|
152
|
+ if [ -d $USB_DRIVE ]; then
|
|
153
|
+ mount $USB_DRIVE /media/usb
|
|
154
|
+ if [ -d /media/usb/Maildir ]; then
|
|
155
|
+ IMPORT_MAILDIR=/media/usb/Maildir
|
|
156
|
+ fi
|
|
157
|
+ if [ -f /media/usb/private_key.gpg ]; then
|
|
158
|
+ MY_GPG_PRIVATE_KEY=/media/usb/private_key.gpg
|
|
159
|
+ fi
|
|
160
|
+ if [ -f /media/usb/public_key.gpg ]; then
|
|
161
|
+ MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg
|
|
162
|
+ fi
|
|
163
|
+ if [ -f /media/usb/id_rsa ]; then
|
|
164
|
+ cp /media/usb/id_rsa /home/$MY_USERNAME/.ssh/id_rsa
|
|
165
|
+ chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh/id_rsa
|
|
166
|
+ # for security delete the private key from the usb drive
|
|
167
|
+ shred -zu /media/usb/id_rsa
|
|
168
|
+ fi
|
|
169
|
+ if [ -f /media/usb/id_rsa.pub ]; then
|
|
170
|
+ cp /media/usb/id_rsa.pub /home/$MY_USERNAME/.ssh/id_rsa.pub
|
|
171
|
+ chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh/id_rsa.pub
|
|
172
|
+ fi
|
|
173
|
+ fi
|
|
174
|
+ echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
|
|
175
|
+}
|
|
176
|
+
|
143
|
177
|
function remove_proprietary_repos {
|
144
|
178
|
if grep -Fxq "remove_proprietary_repos" $COMPLETION_FILE; then
|
145
|
179
|
return
|
|
@@ -1117,6 +1151,7 @@ change_debian_repos
|
1117
|
1151
|
enable_backports
|
1118
|
1152
|
configure_dns
|
1119
|
1153
|
initial_setup
|
|
1154
|
+search_for_attached_usb_drive
|
1120
|
1155
|
install_editor
|
1121
|
1156
|
change_login_message
|
1122
|
1157
|
update_the_kernel
|