Rearrange initial setup

This commit is contained in:
Bob Mottram 2015-11-23 22:03:17 +00:00
parent 961cf68f58
commit f010abb159
1 changed files with 27 additions and 18 deletions

View File

@ -200,6 +200,24 @@ create_generic_image() {
cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
# initial setup of the system # initial setup of the system
if [ -f ~/.initial_setup ]; then
echo "
.---. . .
| | |
|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
| | (.-' (.-' ( | ( )| | | | )( )| | (.-'
' ' --' --' -' - -' ' ' -' -' -' ' - --'
Initial setup process
Please enter your password a second time.
"
sudo su
fi
EOF
cat >> $rootdir/root/.bashrc <<EOF
# initial setup of the system
if [ -f ~/.initial_setup ]; then if [ -f ~/.initial_setup ]; then
clear clear
echo " echo "
@ -211,33 +229,24 @@ if [ -f ~/.initial_setup ]; then
Initial setup process Initial setup process
" "
echo 'This is your new password. Use whenever you wish to ssh into' echo 'This is your new password. Use it whenever you wish to ssh into'
echo 'this system.' echo 'this system.'
echo '' echo ''
EOF EOF
echo ' if [ -f ~/login.txt ]; then' >> $rootdir/root/.bashrc
echo ' NEW_USER_PASSWORD=$(cat ~/login.txt)' >> $rootdir/root/.bashrc
echo ' else' >> $rootdir/root/.bashrc
echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
echo ' fi' >> $rootdir/root/.bashrc
echo ' echo -n "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
echo ' echo " $NEW_USER_PASSWORD"' >> $rootdir/root/.bashrc
echo ' if [ -f ~/login.txt ]; then' >> $rootdir/home/$MY_USERNAME/.bashrc cat >> $rootdir/root/.bashrc <<EOF
echo ' NEW_USER_PASSWORD=$(cat ~/login.txt)' >> $rootdir/home/$MY_USERNAME/.bashrc
echo ' else' >> $rootdir/home/$MY_USERNAME/.bashrc
echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/home/$MY_USERNAME/.bashrc
echo ' fi' >> $rootdir/home/$MY_USERNAME/.bashrc
echo ' echo -n "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/home/$MY_USERNAME/.bashrc
echo ' echo " $NEW_USER_PASSWORD"' >> $rootdir/home/$MY_USERNAME/.bashrc
cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
echo '' echo ''
echo 'Copy it into a password manager or write it down somewhere.' echo 'Copy it into a password manager or write it down somewhere.'
echo '' echo ''
read -n1 -r -p "Press any key to continue..." key read -n1 -r -p "Press any key to continue..." key
EOF
echo " echo '$MY_PASSWORD' | sudo su" >> $rootdir/home/$MY_USERNAME/.bashrc
cat >> $rootdir/home/$MY_USERNAME/.bashrc <<EOF
fi
EOF
cat >> $rootdir/root/.bashrc <<EOF
# initial setup of the system
if [ -f ~/.initial_setup ]; then
freedombone menuconfig freedombone menuconfig
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
EOF EOF