|
@@ -87,55 +87,55 @@ WIFI_HOTSPOT='no'
|
87
|
87
|
WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
|
88
|
88
|
|
89
|
89
|
enable_eatmydata_override() {
|
90
|
|
- chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
91
|
|
- if [ -x $rootdir/usr/bin/eatmydata ] && \
|
92
|
|
- [ ! -f $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata ]; then
|
93
|
|
- echo $"info: Adding apt config to call dpkg via eatmydata"
|
94
|
|
- printf "#!/bin/sh\nexec eatmydata dpkg \"\$@\"\n" \
|
95
|
|
- > $rootdir/var/tmp/dpkg-eatmydata
|
96
|
|
- chmod 755 $rootdir/var/tmp/dpkg-eatmydata
|
97
|
|
- cat > $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata <<EOF
|
98
|
|
- Dir::Bin::dpkg "/var/tmp/dpkg-eatmydata";
|
99
|
|
- EOF
|
100
|
|
- else
|
101
|
|
- echo $"error: unable to find /usr/bin/eatmydata after installing the eatmydata package"
|
102
|
|
- fi
|
|
90
|
+ chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
|
91
|
+ if [ -x $rootdir/usr/bin/eatmydata ] && \
|
|
92
|
+ [ ! -f $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata ]; then
|
|
93
|
+ echo $"info: Adding apt config to call dpkg via eatmydata"
|
|
94
|
+ printf "#!/bin/sh\nexec eatmydata dpkg \"\$@\"\n" \
|
|
95
|
+ > $rootdir/var/tmp/dpkg-eatmydata
|
|
96
|
+ chmod 755 $rootdir/var/tmp/dpkg-eatmydata
|
|
97
|
+ cat > $rootdir/etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata <<EOF
|
|
98
|
+ Dir::Bin::dpkg "/var/tmp/dpkg-eatmydata";
|
|
99
|
+ EOF
|
|
100
|
+ else
|
|
101
|
+ echo $"error: unable to find /usr/bin/eatmydata after installing the eatmydata package"
|
|
102
|
+ fi
|
103
|
103
|
}
|
104
|
104
|
|
105
|
105
|
disable_eatmydata_override() {
|
106
|
|
- for override in \
|
107
|
|
- /etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata \
|
108
|
|
- /var/tmp/dpkg-eatmydata ; do
|
109
|
|
- echo $"info: Removing apt config to call dpkg via eatmydata"
|
110
|
|
- if [ -f $rootdir$override ] ; then
|
111
|
|
- rm -f $rootdir$override
|
112
|
|
- else
|
113
|
|
- echo $"warning: missing $rootdir$override"
|
114
|
|
- fi
|
115
|
|
- done
|
116
|
|
- sync # Flush file buffers before continuing
|
|
106
|
+ for override in \
|
|
107
|
+ /etc/apt/apt.conf.d/95debian-edu-install-dpkg-eatmydata \
|
|
108
|
+ /var/tmp/dpkg-eatmydata ; do
|
|
109
|
+ echo $"info: Removing apt config to call dpkg via eatmydata"
|
|
110
|
+ if [ -f $rootdir$override ] ; then
|
|
111
|
+ rm -f $rootdir$override
|
|
112
|
+ else
|
|
113
|
+ echo $"warning: missing $rootdir$override"
|
|
114
|
+ fi
|
|
115
|
+ done
|
|
116
|
+ sync # Flush file buffers before continuing
|
117
|
117
|
}
|
118
|
118
|
|
119
|
119
|
set_apt_sources() {
|
120
|
|
- NEW_MIRROR="$1"
|
121
|
|
- COMPONENTS="main"
|
|
120
|
+ NEW_MIRROR="$1"
|
|
121
|
+ COMPONENTS="main"
|
122
|
122
|
|
123
|
|
- cat <<EOF > etc/apt/sources.list
|
124
|
|
- deb $NEW_MIRROR $SUITE $COMPONENTS
|
125
|
|
- deb-src $NEW_MIRROR $SUITE $COMPONENTS
|
|
123
|
+ cat <<EOF > etc/apt/sources.list
|
|
124
|
+ deb $NEW_MIRROR $SUITE $COMPONENTS
|
|
125
|
+ deb-src $NEW_MIRROR $SUITE $COMPONENTS
|
126
|
126
|
|
127
|
|
- #deb http://security.debian.org/ $SUITE/updates main
|
128
|
|
- #deb-src http://security.debian.org/ $SUITE/updates main
|
129
|
|
- EOF
|
|
127
|
+ #deb http://security.debian.org/ $SUITE/updates main
|
|
128
|
+ #deb-src http://security.debian.org/ $SUITE/updates main
|
|
129
|
+ EOF
|
130
|
130
|
}
|
131
|
131
|
|
132
|
132
|
configure_networking() {
|
133
|
|
- if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
134
|
|
- return
|
135
|
|
- fi
|
|
133
|
+ if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
|
134
|
+ return
|
|
135
|
+ fi
|
136
|
136
|
|
137
|
|
- if [[ $GENERIC_IMAGE == "no" ]]; then
|
138
|
|
- echo "# This file describes the network interfaces available on your system
|
|
137
|
+ if [[ $GENERIC_IMAGE == "no" ]]; then
|
|
138
|
+ echo "# This file describes the network interfaces available on your system
|
139
|
139
|
# and how to activate them. For more information, see interfaces(5).
|
140
|
140
|
|
141
|
141
|
# The loopback network interface
|
|
@@ -149,43 +149,43 @@ iface eth0 inet static
|
149
|
149
|
netmask 255.255.255.0
|
150
|
150
|
gateway $ROUTER_IP_ADDRESS
|
151
|
151
|
dns-nameservers $NAMESERVER1 $NAMESERVER2
|
152
|
|
- # Example to keep MAC address between reboots
|
153
|
|
- #hwaddress ether B5:A2:BE:3F:1A:FE
|
154
|
|
-
|
155
|
|
- # The secondary network interface
|
156
|
|
- #auto eth1
|
157
|
|
- #iface eth1 inet dhcp
|
158
|
|
-
|
159
|
|
- # WiFi Example
|
160
|
|
- #auto wlan0
|
161
|
|
- #iface wlan0 inet dhcp
|
162
|
|
- # wpa-ssid \"essid\"
|
163
|
|
- # wpa-psk \"password\"
|
164
|
|
-
|
165
|
|
- # Ethernet/RNDIS gadget (g_ether)
|
166
|
|
- # ... or on host side, usbnet and random hwaddr
|
167
|
|
- # Note on some boards, usb0 is automaticly setup with an init script
|
168
|
|
- #iface usb0 inet static
|
169
|
|
- # address 192.168.7.2
|
170
|
|
- # netmask 255.255.255.0
|
171
|
|
- # network 192.168.7.0
|
172
|
|
- # gateway 192.168.7.1" > $rootdir/etc/network/interfaces
|
173
|
|
-
|
174
|
|
- hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
175
|
|
- a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
176
|
|
- b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
177
|
|
- c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
178
|
|
- d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
179
|
|
- e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
180
|
|
- sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" \
|
181
|
|
- $rootdir/etc/network/interfaces
|
182
|
|
- fi
|
183
|
|
-
|
184
|
|
- sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
|
185
|
|
- sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
|
186
|
|
-
|
187
|
|
- # change the motd to show further install instructions
|
188
|
|
- echo $"
|
|
152
|
+ # Example to keep MAC address between reboots
|
|
153
|
+ #hwaddress ether B5:A2:BE:3F:1A:FE
|
|
154
|
+
|
|
155
|
+ # The secondary network interface
|
|
156
|
+ #auto eth1
|
|
157
|
+ #iface eth1 inet dhcp
|
|
158
|
+
|
|
159
|
+ # WiFi Example
|
|
160
|
+ #auto wlan0
|
|
161
|
+ #iface wlan0 inet dhcp
|
|
162
|
+ # wpa-ssid \"essid\"
|
|
163
|
+ # wpa-psk \"password\"
|
|
164
|
+
|
|
165
|
+ # Ethernet/RNDIS gadget (g_ether)
|
|
166
|
+ # ... or on host side, usbnet and random hwaddr
|
|
167
|
+ # Note on some boards, usb0 is automaticly setup with an init script
|
|
168
|
+ #iface usb0 inet static
|
|
169
|
+ # address 192.168.7.2
|
|
170
|
+ # netmask 255.255.255.0
|
|
171
|
+ # network 192.168.7.0
|
|
172
|
+ # gateway 192.168.7.1" > $rootdir/etc/network/interfaces
|
|
173
|
+
|
|
174
|
+ hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
|
175
|
+ a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|
176
|
+ b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|
177
|
+ c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|
178
|
+ d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|
179
|
+ e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|
180
|
+ sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" \
|
|
181
|
+ $rootdir/etc/network/interfaces
|
|
182
|
+ fi
|
|
183
|
+
|
|
184
|
+ sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
|
|
185
|
+ sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
|
|
186
|
+
|
|
187
|
+ # change the motd to show further install instructions
|
|
188
|
+ echo $"
|
189
|
189
|
.---. . .
|
190
|
190
|
| | |
|
191
|
191
|
|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
@@ -204,57 +204,57 @@ following commands, then enter your details.
|
204
|
204
|
}
|
205
|
205
|
|
206
|
206
|
configure_ssh() {
|
207
|
|
- sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
|
208
|
|
-
|
209
|
|
- if [[ "$SSH_PUBKEY" != "no" ]]; then
|
210
|
|
- if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
|
211
|
|
- mkdir $rootdir/home/$MY_USERNAME/.ssh
|
212
|
|
- fi
|
213
|
|
- echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
|
214
|
|
- chroot $rootdir chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
215
|
|
- sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
|
216
|
|
- echo $"Using ssh public key:"
|
217
|
|
- echo $SSH_PUBKEY
|
218
|
|
- echo $'Password ssh authentication turned off'
|
219
|
|
- fi
|
|
207
|
+ sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
|
|
208
|
+
|
|
209
|
+ if [[ "$SSH_PUBKEY" != "no" ]]; then
|
|
210
|
+ if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
|
|
211
|
+ mkdir $rootdir/home/$MY_USERNAME/.ssh
|
|
212
|
+ fi
|
|
213
|
+ echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
|
|
214
|
+ chroot $rootdir chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
|
215
|
+ sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
|
|
216
|
+ echo $"Using ssh public key:"
|
|
217
|
+ echo $SSH_PUBKEY
|
|
218
|
+ echo $'Password ssh authentication turned off'
|
|
219
|
+ fi
|
220
|
220
|
}
|
221
|
221
|
|
222
|
222
|
admin_user_sudo() {
|
223
|
|
- echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers
|
|
223
|
+ echo "$MY_USERNAME ALL=(ALL) ALL" >> $rootdir/etc/sudoers
|
224
|
224
|
}
|
225
|
225
|
|
226
|
226
|
create_generic_image() {
|
227
|
|
- if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
228
|
|
- return
|
229
|
|
- fi
|
230
|
|
- if [[ $GENERIC_IMAGE == "no" ]]; then
|
231
|
|
- return
|
232
|
|
- fi
|
233
|
|
- VARIANT="full"
|
234
|
|
- if [ $CONFIG_FILENAME ]; then
|
235
|
|
- if [[ "$CONFIG_FILENAME" == *"mesh.cfg"* ]]; then
|
236
|
|
- VARIANT="mesh"
|
237
|
|
- fi
|
238
|
|
- fi
|
239
|
|
-
|
240
|
|
- # Don't install any configuration. This will be a base system
|
241
|
|
- if [[ $VARIANT != "mesh" ]]; then
|
242
|
|
- CONFIG_FILENAME=
|
243
|
|
- else
|
244
|
|
- touch $rootdir/root/.initial_mesh_setup
|
245
|
|
- fi
|
246
|
|
-
|
247
|
|
- # The presence of this file indicates that the initial
|
248
|
|
- # setup has not yet been completed
|
249
|
|
- touch $rootdir/home/$MY_USERNAME/.initial_setup
|
250
|
|
- chroot $rootdir chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.initial_setup
|
251
|
|
- touch $rootdir/root/.initial_setup
|
252
|
|
-
|
253
|
|
- cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
|
254
|
|
- # initial setup of the system
|
255
|
|
- if [ -f ~/.initial_setup ]; then
|
256
|
|
- clear
|
257
|
|
- echo "
|
|
227
|
+ if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
|
228
|
+ return
|
|
229
|
+ fi
|
|
230
|
+ if [[ $GENERIC_IMAGE == "no" ]]; then
|
|
231
|
+ return
|
|
232
|
+ fi
|
|
233
|
+ VARIANT="full"
|
|
234
|
+ if [ $CONFIG_FILENAME ]; then
|
|
235
|
+ if [[ "$CONFIG_FILENAME" == *"mesh.cfg"* ]]; then
|
|
236
|
+ VARIANT="mesh"
|
|
237
|
+ fi
|
|
238
|
+ fi
|
|
239
|
+
|
|
240
|
+ # Don't install any configuration. This will be a base system
|
|
241
|
+ if [[ $VARIANT != "mesh" ]]; then
|
|
242
|
+ CONFIG_FILENAME=
|
|
243
|
+ else
|
|
244
|
+ touch $rootdir/root/.initial_mesh_setup
|
|
245
|
+ fi
|
|
246
|
+
|
|
247
|
+ # The presence of this file indicates that the initial
|
|
248
|
+ # setup has not yet been completed
|
|
249
|
+ touch $rootdir/home/$MY_USERNAME/.initial_setup
|
|
250
|
+ chroot $rootdir chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.initial_setup
|
|
251
|
+ touch $rootdir/root/.initial_setup
|
|
252
|
+
|
|
253
|
+ cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
|
|
254
|
+ # initial setup of the system
|
|
255
|
+ if [ -f ~/.initial_setup ]; then
|
|
256
|
+ clear
|
|
257
|
+ echo "
|
258
|
258
|
.---. . .
|
259
|
259
|
| | |
|
260
|
260
|
|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
@@ -265,189 +265,189 @@ create_generic_image() {
|
265
|
265
|
|
266
|
266
|
Please enter your password a second time.
|
267
|
267
|
"
|
268
|
|
- sudo su
|
269
|
|
- fi
|
270
|
|
- EOF
|
271
|
|
-
|
272
|
|
- echo '# initial setup of the system' >> $rootdir/root/.bashrc
|
273
|
|
- echo 'if [ -f ~/.initial_setup ]; then' >> $rootdir/root/.bashrc
|
274
|
|
- echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
|
275
|
|
- echo ' NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
|
276
|
|
- echo ' else' >> $rootdir/root/.bashrc
|
277
|
|
- echo ' ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc
|
278
|
|
- echo ' if [ $ENTROPY -lt 500 ]; then' >> $rootdir/root/.bashrc
|
279
|
|
- ENTROPY_MESSAGE1=$'Initial setup process'
|
280
|
|
- ENTROPY_MESSAGE2=$'Password Generation'
|
281
|
|
- ENTROPY_MESSAGE3=$'WARNING: The entropy available on this system is too low to generate a password.\n\nThe installation process cannot continue.'
|
282
|
|
- echo " dialog --backtitle \"${ENTROPY_MESSAGE1}\" --title \"${ENTROPY_MESSAGE2}\" --msgbox \"${ENTROPY_MESSAGE3}\" 8 50" >> $rootdir/root/.bashrc
|
283
|
|
- echo ' exit' >> $rootdir/root/.bashrc
|
284
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
285
|
|
- echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
|
286
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
287
|
|
- echo ' echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
|
288
|
|
-
|
289
|
|
- echo ' clear' >> $rootdir/root/.bashrc
|
290
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
291
|
|
- NEW_LOGIN_PASSWORD_MESSAGE1=$'Your new login password is:'
|
292
|
|
- NEW_LOGIN_PASSWORD_MESSAGE2=$'Use it whenever you wish to ssh into this system.'
|
293
|
|
- NEW_LOGIN_PASSWORD_MESSAGE3=$'IMPORTANT: Please take a moment to enter the above password into a\npassword manager or write it down somewhere.'
|
294
|
|
- PRESS_KEY_MESSAGE=$'Press any key to continue...'
|
295
|
|
- echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE1}\"" >> $rootdir/root/.bashrc
|
296
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
297
|
|
- echo ' toilet "${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
|
298
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
299
|
|
- echo ' echo " ${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
|
300
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
301
|
|
- echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE2}\"" >> $rootdir/root/.bashrc
|
302
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
303
|
|
- echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE3}\"" >> $rootdir/root/.bashrc
|
304
|
|
- echo ' echo ""' >> $rootdir/root/.bashrc
|
305
|
|
- echo " read -n1 -r -p \"${PRESS_KEY_MESSAGE}\" key" >> $rootdir/root/.bashrc
|
306
|
|
-
|
307
|
|
- # change the password for the admin user
|
308
|
|
- echo -n " echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc
|
309
|
|
- echo '$(printf `cat ~/login.txt`)"|chpasswd' >> $rootdir/root/.bashrc
|
310
|
|
-
|
311
|
|
- # update before continuing
|
312
|
|
- echo " cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
|
313
|
|
- echo " git stash" >> $rootdir/root/.bashrc
|
314
|
|
- echo " git pull" >> $rootdir/root/.bashrc
|
315
|
|
- echo " make install" >> $rootdir/root/.bashrc
|
316
|
|
-
|
317
|
|
- if [[ $VARIANT != "mesh" ]]; then
|
318
|
|
- if [[ $ONION_ONLY == "no" ]]; then
|
319
|
|
- if [[ $MINIMAL_INSTALL == "no" ]]; then
|
320
|
|
- echo " ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
|
321
|
|
- else
|
322
|
|
- echo " ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
|
323
|
|
- fi
|
324
|
|
- else
|
325
|
|
- echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
|
326
|
|
- fi
|
327
|
|
- else
|
328
|
|
- echo " echo ''" >> $rootdir/root/.bashrc
|
329
|
|
- fi
|
330
|
|
- echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
|
331
|
|
- echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
|
332
|
|
- # Remove the initial setup files
|
333
|
|
- echo ' rm /root/.initial_setup' >> $rootdir/root/.bashrc
|
334
|
|
- echo " rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc
|
335
|
|
- echo " touch /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
336
|
|
- echo ' shred -zu ~/login.txt' >> $rootdir/root/.bashrc
|
337
|
|
- END_MESSAGE1=$'Congratulations!'
|
338
|
|
- if [[ $VARIANT != "mesh" ]]; then
|
339
|
|
- END_MESSAGE2=$'\nYour system has now installed\n\nThe onion ssh service is at $SSH_ONION_HOSTNAME\n\nPress any key to reboot and begin using it'
|
340
|
|
- echo ' SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
|
341
|
|
- else
|
342
|
|
- END_MESSAGE2=$'\nYour system has now installed\n\nPress any key to reboot and begin using it'
|
343
|
|
- fi
|
344
|
|
- echo " dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
|
345
|
|
- echo ' reboot' >> $rootdir/root/.bashrc
|
346
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
347
|
|
- echo ' else' >> $rootdir/root/.bashrc
|
348
|
|
- echo ' key=' >> $rootdir/root/.bashrc
|
349
|
|
- echo ' while [[ $key != "x" ]]; do' >> $rootdir/root/.bashrc
|
350
|
|
- INSTALL_FAIL_MESSAGE=$"Install failed. Press x to continue..."
|
351
|
|
- echo " read -n1 -r -p \"${INSTALL_FAIL_MESSAGE}\" key" >> $rootdir/root/.bashrc
|
352
|
|
- echo ' done' >> $rootdir/root/.bashrc
|
353
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
354
|
|
- echo ' exit' >> $rootdir/root/.bashrc
|
355
|
|
- echo 'else' >> $rootdir/root/.bashrc
|
356
|
|
- echo ' # Remove default account after install' >> $rootdir/root/.bashrc
|
357
|
|
- echo " if [ -f /root/.remove_${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
358
|
|
- echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
359
|
|
- echo " userdel -r ${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
360
|
|
- echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
361
|
|
- echo " rm -rf /home/${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
362
|
|
- echo " rm /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
363
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
364
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
365
|
|
- echo ' fi' >> $rootdir/root/.bashrc
|
366
|
|
- echo 'fi' >> $rootdir/root/.bashrc
|
|
268
|
+ sudo su
|
|
269
|
+ fi
|
|
270
|
+ EOF
|
|
271
|
+
|
|
272
|
+ echo '# initial setup of the system' >> $rootdir/root/.bashrc
|
|
273
|
+ echo 'if [ -f ~/.initial_setup ]; then' >> $rootdir/root/.bashrc
|
|
274
|
+ echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
|
|
275
|
+ echo ' NEW_USER_PASSWORD=$(printf `cat ~/login.txt`)' >> $rootdir/root/.bashrc
|
|
276
|
+ echo ' else' >> $rootdir/root/.bashrc
|
|
277
|
+ echo ' ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc
|
|
278
|
+ echo ' if [ $ENTROPY -lt 500 ]; then' >> $rootdir/root/.bashrc
|
|
279
|
+ ENTROPY_MESSAGE1=$'Initial setup process'
|
|
280
|
+ ENTROPY_MESSAGE2=$'Password Generation'
|
|
281
|
+ ENTROPY_MESSAGE3=$'WARNING: The entropy available on this system is too low to generate a password.\n\nThe installation process cannot continue.'
|
|
282
|
+ echo " dialog --backtitle \"${ENTROPY_MESSAGE1}\" --title \"${ENTROPY_MESSAGE2}\" --msgbox \"${ENTROPY_MESSAGE3}\" 8 50" >> $rootdir/root/.bashrc
|
|
283
|
+ echo ' exit' >> $rootdir/root/.bashrc
|
|
284
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
285
|
+ echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
|
|
286
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
287
|
+ echo ' echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
|
|
288
|
+
|
|
289
|
+ echo ' clear' >> $rootdir/root/.bashrc
|
|
290
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
291
|
+ NEW_LOGIN_PASSWORD_MESSAGE1=$'Your new login password is:'
|
|
292
|
+ NEW_LOGIN_PASSWORD_MESSAGE2=$'Use it whenever you wish to ssh into this system.'
|
|
293
|
+ NEW_LOGIN_PASSWORD_MESSAGE3=$'IMPORTANT: Please take a moment to enter the above password into a\npassword manager or write it down somewhere.'
|
|
294
|
+ PRESS_KEY_MESSAGE=$'Press any key to continue...'
|
|
295
|
+ echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE1}\"" >> $rootdir/root/.bashrc
|
|
296
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
297
|
+ echo ' toilet "${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
|
|
298
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
299
|
+ echo ' echo " ${NEW_USER_PASSWORD}"' >> $rootdir/root/.bashrc
|
|
300
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
301
|
+ echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE2}\"" >> $rootdir/root/.bashrc
|
|
302
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
303
|
+ echo " echo \"${NEW_LOGIN_PASSWORD_MESSAGE3}\"" >> $rootdir/root/.bashrc
|
|
304
|
+ echo ' echo ""' >> $rootdir/root/.bashrc
|
|
305
|
+ echo " read -n1 -r -p \"${PRESS_KEY_MESSAGE}\" key" >> $rootdir/root/.bashrc
|
|
306
|
+
|
|
307
|
+ # change the password for the admin user
|
|
308
|
+ echo -n " echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc
|
|
309
|
+ echo '$(printf `cat ~/login.txt`)"|chpasswd' >> $rootdir/root/.bashrc
|
|
310
|
+
|
|
311
|
+ # update before continuing
|
|
312
|
+ echo " cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
|
|
313
|
+ echo " git stash" >> $rootdir/root/.bashrc
|
|
314
|
+ echo " git pull" >> $rootdir/root/.bashrc
|
|
315
|
+ echo " make install" >> $rootdir/root/.bashrc
|
|
316
|
+
|
|
317
|
+ if [[ $VARIANT != "mesh" ]]; then
|
|
318
|
+ if [[ $ONION_ONLY == "no" ]]; then
|
|
319
|
+ if [[ $MINIMAL_INSTALL == "no" ]]; then
|
|
320
|
+ echo " ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
|
|
321
|
+ else
|
|
322
|
+ echo " ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
|
|
323
|
+ fi
|
|
324
|
+ else
|
|
325
|
+ echo " ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
|
|
326
|
+ fi
|
|
327
|
+ else
|
|
328
|
+ echo " echo ''" >> $rootdir/root/.bashrc
|
|
329
|
+ fi
|
|
330
|
+ echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
|
|
331
|
+ echo " if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
|
|
332
|
+ # Remove the initial setup files
|
|
333
|
+ echo ' rm /root/.initial_setup' >> $rootdir/root/.bashrc
|
|
334
|
+ echo " rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc
|
|
335
|
+ echo " touch /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
|
336
|
+ echo ' shred -zu ~/login.txt' >> $rootdir/root/.bashrc
|
|
337
|
+ END_MESSAGE1=$'Congratulations!'
|
|
338
|
+ if [[ $VARIANT != "mesh" ]]; then
|
|
339
|
+ END_MESSAGE2=$'\nYour system has now installed\n\nThe onion ssh service is at $SSH_ONION_HOSTNAME\n\nPress any key to reboot and begin using it'
|
|
340
|
+ echo ' SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
|
|
341
|
+ else
|
|
342
|
+ END_MESSAGE2=$'\nYour system has now installed\n\nPress any key to reboot and begin using it'
|
|
343
|
+ fi
|
|
344
|
+ echo " dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" 9 50" >> $rootdir/root/.bashrc
|
|
345
|
+ echo ' reboot' >> $rootdir/root/.bashrc
|
|
346
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
347
|
+ echo ' else' >> $rootdir/root/.bashrc
|
|
348
|
+ echo ' key=' >> $rootdir/root/.bashrc
|
|
349
|
+ echo ' while [[ $key != "x" ]]; do' >> $rootdir/root/.bashrc
|
|
350
|
+ INSTALL_FAIL_MESSAGE=$"Install failed. Press x to continue..."
|
|
351
|
+ echo " read -n1 -r -p \"${INSTALL_FAIL_MESSAGE}\" key" >> $rootdir/root/.bashrc
|
|
352
|
+ echo ' done' >> $rootdir/root/.bashrc
|
|
353
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
354
|
+ echo ' exit' >> $rootdir/root/.bashrc
|
|
355
|
+ echo 'else' >> $rootdir/root/.bashrc
|
|
356
|
+ echo ' # Remove default account after install' >> $rootdir/root/.bashrc
|
|
357
|
+ echo " if [ -f /root/.remove_${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
|
358
|
+ echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
|
359
|
+ echo " userdel -r ${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
|
360
|
+ echo " if [ -d /home/${GENERIC_IMAGE_USERNAME} ]; then" >> $rootdir/root/.bashrc
|
|
361
|
+ echo " rm -rf /home/${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
|
362
|
+ echo " rm /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
|
|
363
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
364
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
365
|
+ echo ' fi' >> $rootdir/root/.bashrc
|
|
366
|
+ echo 'fi' >> $rootdir/root/.bashrc
|
367
|
367
|
}
|
368
|
368
|
|
369
|
369
|
continue_installation() {
|
370
|
|
- # If a configuration file exists then run with it
|
371
|
|
- # otherwise the interactive installer can be used
|
372
|
|
- # This is equivalent to installing freedombox-setup on freedombox
|
373
|
|
- if [ $CONFIG_FILENAME ]; then
|
374
|
|
- if [ ${#CONFIG_FILENAME} -gt 2 ]; then
|
375
|
|
- cp $CONFIG_FILENAME $rootdir/root/$PROJECT_NAME.cfg
|
376
|
|
- cat $rootdir/root/$PROJECT_NAME.cfg
|
377
|
|
- chroot "$rootdir" su -c "$PROJECT_NAME -c /root/$PROJECT_NAME.cfg" - root
|
378
|
|
- fi
|
379
|
|
- fi
|
|
370
|
+ # If a configuration file exists then run with it
|
|
371
|
+ # otherwise the interactive installer can be used
|
|
372
|
+ # This is equivalent to installing freedombox-setup on freedombox
|
|
373
|
+ if [ $CONFIG_FILENAME ]; then
|
|
374
|
+ if [ ${#CONFIG_FILENAME} -gt 2 ]; then
|
|
375
|
+ cp $CONFIG_FILENAME $rootdir/root/$PROJECT_NAME.cfg
|
|
376
|
+ cat $rootdir/root/$PROJECT_NAME.cfg
|
|
377
|
+ chroot "$rootdir" su -c "$PROJECT_NAME -c /root/$PROJECT_NAME.cfg" - root
|
|
378
|
+ fi
|
|
379
|
+ fi
|
380
|
380
|
}
|
381
|
381
|
|
382
|
382
|
atheros_wifi() {
|
383
|
|
- firmware_filename="open-ath9k-htc-firmware_1.3-1_all.deb"
|
384
|
|
- firmware_hash='5fea58ffefdf0ef15b504db7fbe3bc078c03e0d927bba64085e4b6f2546102f5'
|
385
|
|
-
|
386
|
|
- firmware_url="http://us.archive.trisquel.info/trisquel/pool/main/o/open-ath9k-htc-firmware/$firmware_filename"
|
387
|
|
- firmware_tempfile="/tmp/$firmware_filename"
|
388
|
|
- wget "$firmware_url" -O "$rootdir$firmware_tempfile"
|
389
|
|
- downloaded_firmware_hash=$(sha256sum "$rootdir$firmware_tempfile" | awk -F ' ' '{print $1}')
|
390
|
|
- if [[ "$downloaded_firmware_hash" == "$firmware_hash" ]]; then
|
391
|
|
- chroot "$rootdir" dpkg -i "$firmware_tempfile"
|
392
|
|
- else
|
393
|
|
- echo 'WARNING: Atheros Wifi firmware hash does not match. The driver has not been installed.'
|
394
|
|
- fi
|
|
383
|
+ firmware_filename="open-ath9k-htc-firmware_1.3-1_all.deb"
|
|
384
|
+ firmware_hash='5fea58ffefdf0ef15b504db7fbe3bc078c03e0d927bba64085e4b6f2546102f5'
|
|
385
|
+
|
|
386
|
+ firmware_url="http://us.archive.trisquel.info/trisquel/pool/main/o/open-ath9k-htc-firmware/$firmware_filename"
|
|
387
|
+ firmware_tempfile="/tmp/$firmware_filename"
|
|
388
|
+ wget "$firmware_url" -O "$rootdir$firmware_tempfile"
|
|
389
|
+ downloaded_firmware_hash=$(sha256sum "$rootdir$firmware_tempfile" | awk -F ' ' '{print $1}')
|
|
390
|
+ if [[ "$downloaded_firmware_hash" == "$firmware_hash" ]]; then
|
|
391
|
+ chroot "$rootdir" dpkg -i "$firmware_tempfile"
|
|
392
|
+ else
|
|
393
|
+ echo 'WARNING: Atheros Wifi firmware hash does not match. The driver has not been installed.'
|
|
394
|
+ fi
|
395
|
395
|
}
|
396
|
396
|
|
397
|
397
|
|
398
|
398
|
initialise_mesh() {
|
399
|
|
- if [[ $VARIANT != "mesh" || $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
400
|
|
- return
|
401
|
|
- fi
|
402
|
|
- freedombone-mesh-install -f firewall -r "${rootdir}"
|
403
|
|
- freedombone-mesh-install -f avahi -r "${rootdir}"
|
404
|
|
- freedombone-mesh-install -f batman -r "${rootdir}"
|
405
|
|
- freedombone-mesh-install -f tox_node -r "${rootdir}"
|
406
|
|
- freedombone-mesh-install -f tox_client -r "${rootdir}"
|
407
|
|
- freedombone-mesh-install -f zeronet -r "${rootdir}"
|
408
|
|
-
|
409
|
|
- MESH_SERVICE='mesh-setup.service'
|
410
|
|
- MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE
|
411
|
|
-
|
412
|
|
- echo '[Unit]' > $MESH_SETUP_DAEMON
|
413
|
|
- echo 'Description=Initial mesh router configuration' >> $MESH_SETUP_DAEMON
|
414
|
|
- echo 'After=syslog.target' >> $MESH_SETUP_DAEMON
|
415
|
|
- echo 'After=network.target' >> $MESH_SETUP_DAEMON
|
416
|
|
- echo '[Service]' >> $MESH_SETUP_DAEMON
|
417
|
|
- echo 'Type=simple' >> $MESH_SETUP_DAEMON
|
418
|
|
- echo 'User=root' >> $MESH_SETUP_DAEMON
|
419
|
|
- echo 'Group=root' >> $MESH_SETUP_DAEMON
|
420
|
|
- echo 'WorkingDirectory=/root' >> $MESH_SETUP_DAEMON
|
421
|
|
- echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-image-mesh > /var/log/mesh-setup.log" >> $MESH_SETUP_DAEMON
|
422
|
|
- echo '' >> $MESH_SETUP_DAEMON
|
423
|
|
- echo 'TimeoutSec=99999' >> $MESH_SETUP_DAEMON
|
424
|
|
- echo '' >> $MESH_SETUP_DAEMON
|
425
|
|
- echo '[Install]' >> $MESH_SETUP_DAEMON
|
426
|
|
- echo 'WantedBy=multi-user.target' >> $MESH_SETUP_DAEMON
|
427
|
|
- chroot "$rootdir" systemctl enable $MESH_SERVICE
|
|
399
|
+ if [[ $VARIANT != "mesh" || $DEBIAN_INSTALL_ONLY != "no" ]]; then
|
|
400
|
+ return
|
|
401
|
+ fi
|
|
402
|
+ freedombone-mesh-install -f firewall -r "${rootdir}"
|
|
403
|
+ freedombone-mesh-install -f avahi -r "${rootdir}"
|
|
404
|
+ freedombone-mesh-install -f batman -r "${rootdir}"
|
|
405
|
+ freedombone-mesh-install -f tox_node -r "${rootdir}"
|
|
406
|
+ freedombone-mesh-install -f tox_client -r "${rootdir}"
|
|
407
|
+ freedombone-mesh-install -f zeronet -r "${rootdir}"
|
|
408
|
+
|
|
409
|
+ MESH_SERVICE='mesh-setup.service'
|
|
410
|
+ MESH_SETUP_DAEMON=$rootdir/etc/systemd/system/$MESH_SERVICE
|
|
411
|
+
|
|
412
|
+ echo '[Unit]' > $MESH_SETUP_DAEMON
|
|
413
|
+ echo 'Description=Initial mesh router configuration' >> $MESH_SETUP_DAEMON
|
|
414
|
+ echo 'After=syslog.target' >> $MESH_SETUP_DAEMON
|
|
415
|
+ echo 'After=network.target' >> $MESH_SETUP_DAEMON
|
|
416
|
+ echo '[Service]' >> $MESH_SETUP_DAEMON
|
|
417
|
+ echo 'Type=simple' >> $MESH_SETUP_DAEMON
|
|
418
|
+ echo 'User=root' >> $MESH_SETUP_DAEMON
|
|
419
|
+ echo 'Group=root' >> $MESH_SETUP_DAEMON
|
|
420
|
+ echo 'WorkingDirectory=/root' >> $MESH_SETUP_DAEMON
|
|
421
|
+ echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-image-mesh > /var/log/mesh-setup.log" >> $MESH_SETUP_DAEMON
|
|
422
|
+ echo '' >> $MESH_SETUP_DAEMON
|
|
423
|
+ echo 'TimeoutSec=99999' >> $MESH_SETUP_DAEMON
|
|
424
|
+ echo '' >> $MESH_SETUP_DAEMON
|
|
425
|
+ echo '[Install]' >> $MESH_SETUP_DAEMON
|
|
426
|
+ echo 'WantedBy=multi-user.target' >> $MESH_SETUP_DAEMON
|
|
427
|
+ chroot "$rootdir" systemctl enable $MESH_SERVICE
|
428
|
428
|
}
|
429
|
429
|
|
430
|
430
|
configure_wifi() {
|
431
|
|
- if [[ $VARIANT == "mesh" ]]; then
|
432
|
|
- return
|
433
|
|
- fi
|
434
|
|
-
|
435
|
|
- if [ -f $WIFI_NETWORKS_FILE ]; then
|
436
|
|
- chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
|
437
|
|
- return
|
438
|
|
- fi
|
439
|
|
-
|
440
|
|
- if [[ $WIFI_TYPE != 'none' ]]; then
|
441
|
|
- if [ ! $WIFI_PASSPHRASE ]; then
|
442
|
|
- return
|
443
|
|
- fi
|
444
|
|
- if [ ${#WIFI_PASSPHRASE} -lt 2 ]; then
|
445
|
|
- return
|
446
|
|
- fi
|
447
|
|
- chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $HOTSPOT
|
448
|
|
- else
|
449
|
|
- chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT
|
450
|
|
- fi
|
|
431
|
+ if [[ $VARIANT == "mesh" ]]; then
|
|
432
|
+ return
|
|
433
|
+ fi
|
|
434
|
+
|
|
435
|
+ if [ -f $WIFI_NETWORKS_FILE ]; then
|
|
436
|
+ chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
|
|
437
|
+ return
|
|
438
|
+ fi
|
|
439
|
+
|
|
440
|
+ if [[ $WIFI_TYPE != 'none' ]]; then
|
|
441
|
+ if [ ! $WIFI_PASSPHRASE ]; then
|
|
442
|
+ return
|
|
443
|
+ fi
|
|
444
|
+ if [ ${#WIFI_PASSPHRASE} -lt 2 ]; then
|
|
445
|
+ return
|
|
446
|
+ fi
|
|
447
|
+ chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $HOTSPOT
|
|
448
|
+ else
|
|
449
|
+ chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT
|
|
450
|
+ fi
|
451
|
451
|
}
|
452
|
452
|
|
453
|
453
|
# Set to true/false to control if eatmydata is used during build
|
|
@@ -475,16 +475,16 @@ echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
|
475
|
475
|
chroot "$rootdir" adduser $username sudo
|
476
|
476
|
|
477
|
477
|
case "$MACHINE" in
|
478
|
|
- virtualbox)
|
479
|
|
- # hide irrelevant console keyboard messages.
|
480
|
|
- echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
|
481
|
|
- >> /etc/init.d/rc.local
|
482
|
|
- ;;
|
483
|
|
- qemu)
|
484
|
|
- # hide irrelevant console keyboard messages.
|
485
|
|
- echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
|
486
|
|
- >> /etc/init.d/rc.local
|
487
|
|
- ;;
|
|
478
|
+ virtualbox)
|
|
479
|
+ # hide irrelevant console keyboard messages.
|
|
480
|
+ echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
|
|
481
|
+ >> /etc/init.d/rc.local
|
|
482
|
+ ;;
|
|
483
|
+ qemu)
|
|
484
|
+ # hide irrelevant console keyboard messages.
|
|
485
|
+ echo "echo \"4 4 1 7\" > /proc/sys/kernel/printk" \
|
|
486
|
+ >> /etc/init.d/rc.local
|
|
487
|
+ ;;
|
488
|
488
|
esac
|
489
|
489
|
|
490
|
490
|
set_apt_sources $BUILD_MIRROR
|
|
@@ -494,19 +494,19 @@ chroot "$rootdir" apt-get clean
|
494
|
494
|
chroot "$rootdir" apt-get update
|
495
|
495
|
|
496
|
496
|
cat > $rootdir/usr/sbin/policy-rc.d <<EOF
|
497
|
|
- #!/bin/sh
|
498
|
|
- exit 101
|
499
|
|
- EOF
|
|
497
|
+ #!/bin/sh
|
|
498
|
+ exit 101
|
|
499
|
+ EOF
|
500
|
500
|
chmod a+rx $rootdir/usr/sbin/policy-rc.d
|
501
|
501
|
|
502
|
502
|
if $use_eatmydata ; then
|
503
|
|
- enable_eatmydata_override
|
|
503
|
+ enable_eatmydata_override
|
504
|
504
|
fi
|
505
|
505
|
|
506
|
506
|
if [ -n "$CUSTOM_SETUP" ]; then
|
507
|
|
- cp "$CUSTOM_SETUP" "$rootdir"/tmp
|
508
|
|
- chroot "$rootdir" apt-get install -y gdebi-core
|
509
|
|
- chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
|
|
507
|
+ cp "$CUSTOM_SETUP" "$rootdir"/tmp
|
|
508
|
+ chroot "$rootdir" apt-get install -y gdebi-core
|
|
509
|
+ chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
|
510
|
510
|
fi
|
511
|
511
|
|
512
|
512
|
chroot "$rootdir" apt-get install -y sudo git dialog toilet build-essential openssh-server
|
|
@@ -518,45 +518,45 @@ chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools
|
518
|
518
|
sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
|
519
|
519
|
|
520
|
520
|
chroot "$rootdir" /bin/bash -x <<EOF
|
521
|
|
- git clone $PROJECT_REPO /root/$PROJECT_NAME
|
522
|
|
- cd /root/$PROJECT_NAME
|
523
|
|
- make install
|
524
|
|
- EOF
|
|
521
|
+ git clone $PROJECT_REPO /root/$PROJECT_NAME
|
|
522
|
+ cd /root/$PROJECT_NAME
|
|
523
|
+ make install
|
|
524
|
+ EOF
|
525
|
525
|
|
526
|
526
|
chroot "$rootdir" ${PROJECT_NAME}-image-hardware-setup 2>&1 | \
|
527
|
|
- tee $rootdir/var/log/${PROJECT_NAME}-image-hardware-setup.log
|
|
527
|
+ tee $rootdir/var/log/${PROJECT_NAME}-image-hardware-setup.log
|
528
|
528
|
|
529
|
529
|
rm $rootdir/usr/sbin/policy-rc.d
|
530
|
530
|
|
531
|
531
|
# Set up HRNG for systems known to have one
|
532
|
532
|
# Otherwise install haveged
|
533
|
533
|
if [[ "$MACHINE" != "beaglebone" ]]; then
|
534
|
|
- chroot $rootdir apt-get -y install haveged
|
|
534
|
+ chroot $rootdir apt-get -y install haveged
|
535
|
535
|
else
|
536
|
|
- chroot $rootdir apt-get -y install rng-tools
|
537
|
|
- sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
|
|
536
|
+ chroot $rootdir apt-get -y install rng-tools
|
|
537
|
+ sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
|
538
|
538
|
fi
|
539
|
539
|
|
540
|
540
|
# copy u-boot to beginning of image
|
541
|
541
|
case "$MACHINE" in
|
542
|
|
- beaglebone)
|
543
|
|
- dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
|
544
|
|
- count=1 seek=1 conv=notrunc bs=128k
|
545
|
|
- dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
|
546
|
|
- count=2 seek=1 conv=notrunc bs=384k
|
547
|
|
- ;;
|
548
|
|
- cubieboard2)
|
549
|
|
- dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
|
550
|
|
- seek=8 conv=notrunc bs=1k
|
551
|
|
- ;;
|
552
|
|
- a20-olinuxino-lime)
|
553
|
|
- dd if=$rootdir/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin \
|
554
|
|
- of="$image" seek=8 conv=notrunc bs=1k
|
555
|
|
- ;;
|
|
542
|
+ beaglebone)
|
|
543
|
+ dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
|
|
544
|
+ count=1 seek=1 conv=notrunc bs=128k
|
|
545
|
+ dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
|
|
546
|
+ count=2 seek=1 conv=notrunc bs=384k
|
|
547
|
+ ;;
|
|
548
|
+ cubieboard2)
|
|
549
|
+ dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
|
|
550
|
+ seek=8 conv=notrunc bs=1k
|
|
551
|
+ ;;
|
|
552
|
+ a20-olinuxino-lime)
|
|
553
|
+ dd if=$rootdir/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin \
|
|
554
|
+ of="$image" seek=8 conv=notrunc bs=1k
|
|
555
|
+ ;;
|
556
|
556
|
esac
|
557
|
557
|
|
558
|
558
|
if $use_eatmydata ; then
|
559
|
|
- disable_eatmydata_override
|
|
559
|
+ disable_eatmydata_override
|
560
|
560
|
fi
|
561
|
561
|
|
562
|
562
|
set_apt_sources $MIRROR
|