#!/bin/bash # Simple text based preferences setter. # (C) Michael Moore, 2005 stuporglue@gmail.com, http://stuporglue.org # Licenced under the GPL v.2 DONE="false" DONEXT="nothing" while [ "$DONE" == "false" ] do # Echo out the menu options clear echo "" echo "----------Simple Preferences Editor-----------" echo "" echo " [c] Clean up disk space" echo " [f] Check free space" echo " [l] Update 'locate' database" echo " [n] Reconfigure Network with DHCP" echo " [p] Change Password" echo " [t] Set time and date" echo " [u] Get Updates" echo "" echo " [q] Exit" echo "" echo "Type your menu choice and press enter:" echo "" read -e DONEXT clear echo "" echo "" if [ "$DONEXT" == "n" ] then echo " Restarting network connection on eth0." echo " Make sure your network cable is plugged in." echo " Enter your password to continue:" echo "" sudo ifdown eth0 sudo ifup eth0 echo "" echo " Done trying to configure network. Press Enter to continue" fi if [ "$DONEXT" == "t" ] then echo " The date and time are currently set to `date`" echo " Would you like to change them? [y/N]" read -e CONTINUENOW if [ "$CONTINUENOW" == "y" ] then echo " What is the Month? Use a two digit number (January = 01)" echo "" read -e MONTH echo "" echo " What is the Date? Use a two digit number (2nd = 02)" read -e DAY echo "" echo " What is the Hour? Use a two digit number," echo " in 24 hour format (10PM = 22)" read -e HOURS echo " How many minutes past the hour? Use a two digit number (5 = 05)" read -e MINUTES echo "" echo " What are the last two digits of the year? (2005 = 05)" read -e YEAR echo "" echo " Please enter your password to set the date now." sudo date $MONTH$DAY$HOURS$MINUTES$YEAR echo " The date and time have been set to `date`" echo " Press Enter to continue" read -e CONTINUENOW fi fi if [ "$DONEXT" == "l" ] then echo " Updating 'locate' database. This may take a while." echo " Please enter your password to begin." sudo updatedb echo "" echo " Update complete. Press enter to continue." read -e CONTINUENOW fi if [ "$DONEXT" == "c" ] then sudo apt-get clean rm -r ~/.mozilla/firefox/*/Cache/* echo " Cleaning complete. Press enter to continue." read -e CONTINUENOW fi if [ "$DONEXT" == "f" ] then echo " 'Mounted on /' is your main disk, and the most important" echo "" df -h echo "" echo "" echo " Press enter to continue." read -e CONTINUENOW fi if [ "$DONEXT" == "q" ] then DONE="true" fi if [ "$DONEXT" == "p" ] then echo " Change your password below." echo " You will not be able to see what you type." echo "" passwd echo "" echo " Done with password. Press Enter to continue." read -e CONTINUENOW fi if [ "$DONEXT" == "u" ] then sudo apt-get update sudo apt-get upgrade clear echo "" echo " Updates done. If a lot of updates occured," echo " you should consider rebooting to apply changes." echo "" echo " Press Enter to continue" read -e CONTINUENOW fi done # end of while loop clear echo "" echo " Done. You may close this window." exit 0