Bläddra i källkod

Rearrange initial setup

Bob Mottram 9 år sedan
förälder
incheckning
f010abb159
1 ändrade filer med 27 tillägg och 18 borttagningar
  1. 27
    18
      src/freedombone-image-customise

+ 27
- 18
src/freedombone-image-customise Visa fil

201
     cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
201
     cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
202
 # initial setup of the system
202
 # initial setup of the system
203
 if [ -f ~/.initial_setup ]; then
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
     clear
222
     clear
205
     echo "
223
     echo "
206
  .---.                  .              .
224
  .---.                  .              .
211
 
229
 
212
                    Initial setup process
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
     echo 'this system.'
233
     echo 'this system.'
216
     echo ''
234
     echo ''
217
 EOF
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
     echo ''
245
     echo ''
229
     echo 'Copy it into a password manager or write it down somewhere.'
246
     echo 'Copy it into a password manager or write it down somewhere.'
230
     echo ''
247
     echo ''
231
     read -n1 -r -p "Press any key to continue..." key
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
     freedombone menuconfig
250
     freedombone menuconfig
242
     if [ "$?" = "0" ]; then
251
     if [ "$?" = "0" ]; then
243
 EOF
252
 EOF