Selaa lähdekoodia

Rearrange initial setup

Bob Mottram 9 vuotta sitten
vanhempi
commit
f010abb159
1 muutettua tiedostoa jossa 27 lisäystä ja 18 poistoa
  1. 27
    18
      src/freedombone-image-customise

+ 27
- 18
src/freedombone-image-customise Näytä tiedosto

@@ -201,6 +201,24 @@ create_generic_image() {
201 201
     cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
202 202
 # initial setup of the system
203 203
 if [ -f ~/.initial_setup ]; then
204
+    echo "
205
+ .---.                  .              .
206
+ |                      |              |
207
+ |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
208
+ |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
209
+ '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
210
+
211
+                   Initial setup process
212
+
213
+          Please enter your password a second time.
214
+"
215
+    sudo su
216
+fi
217
+EOF
218
+
219
+    cat >> $rootdir/root/.bashrc <<EOF
220
+# initial setup of the system
221
+if [ -f ~/.initial_setup ]; then
204 222
     clear
205 223
     echo "
206 224
  .---.                  .              .
@@ -211,33 +229,24 @@ if [ -f ~/.initial_setup ]; then
211 229
 
212 230
                    Initial setup process
213 231
 "
214
-    echo 'This is your new password. Use whenever you wish to ssh into'
232
+    echo 'This is your new password. Use it whenever you wish to ssh into'
215 233
     echo 'this system.'
216 234
     echo ''
217 235
 EOF
236
+    echo '    if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
237
+    echo '        NEW_USER_PASSWORD=$(cat ~/login.txt)' >> $rootdir/root/.bashrc
238
+    echo '    else' >> $rootdir/root/.bashrc
239
+    echo '        NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
240
+    echo '    fi' >> $rootdir/root/.bashrc
241
+    echo '    echo -n "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
242
+    echo '    echo "    $NEW_USER_PASSWORD"' >> $rootdir/root/.bashrc
218 243
 
219
-    echo '    if [ -f ~/login.txt ]; then' >> $rootdir/home/$MY_USERNAME/.bashrc
220
-    echo '        NEW_USER_PASSWORD=$(cat ~/login.txt)' >> $rootdir/home/$MY_USERNAME/.bashrc
221
-    echo '    else' >> $rootdir/home/$MY_USERNAME/.bashrc
222
-    echo '        NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/home/$MY_USERNAME/.bashrc
223
-    echo '    fi' >> $rootdir/home/$MY_USERNAME/.bashrc
224
-    echo '    echo -n "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/home/$MY_USERNAME/.bashrc
225
-    echo '    echo "    $NEW_USER_PASSWORD"' >> $rootdir/home/$MY_USERNAME/.bashrc
226
-
227
-    cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
244
+    cat >> $rootdir/root/.bashrc <<EOF
228 245
     echo ''
229 246
     echo 'Copy it into a password manager or write it down somewhere.'
230 247
     echo ''
231 248
     read -n1 -r -p "Press any key to continue..." key
232
-EOF
233
-    echo "    echo '$MY_PASSWORD' | sudo su" >> $rootdir/home/$MY_USERNAME/.bashrc
234
-    cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
235
-fi
236
-EOF
237 249
 
238
-    cat >> $rootdir/root/.bashrc <<EOF
239
-# initial setup of the system
240
-if [ -f ~/.initial_setup ]; then
241 250
     freedombone menuconfig
242 251
     if [ "$?" = "0" ]; then
243 252
 EOF