Code Sample |
#!/bin/bash #Script to setup gtk+-2.12.9 #Idea and script by WDef, tweaked for dialog. dialog --title "Setup GTK+-2.12.9" --yesno "This setup will cause the system to link programs to the newer libraries in /opt/gtk+-2.12.9/lib in priority over those in the system or other extensions. This is basically harmless and shouldn't break anything. Do you want to proceed?" 20 50 3 if [ $? = 1 ]; then dialog --title "Setup GTK+-2.12.9" --msgbox "No changes were made. Exiting.." 20 50 10 else # Check for the existance of /etc/ld.so.conf if [ ! -e /etc/ld.so.conf ]; then dialog --title "Setup GTK+-2.12.9" --msgbox "You do not have an /etc/ld.so.conf. Something is very wrong. Exiting.." 20 50 3 exit 1; fi # Check for /etc/ld.so.conf entry. if head -1 /etc/ld.so.conf | grep /opt/gtk+-2.12.9/lib > /dev/null 2>&1; then sudo ldconfig dialog --title "Setup GTK+-2.12.9" --msgbox "GTK+-2.12.9 is already set up on the system. No changes were made. Exiting..." 20 50 3 # already done exit 1; fi # Get rid of symlink and copy file from KNOPPIX image if needed. if [ -L /etc/ld.so.conf ]; then sudo rm -f /etc/ld.so.conf sudo cp /KNOPPIX/etc/ld.so.conf /etc/ld.so.conf else sudo cp -f /etc/ld.so.conf /etc/ld.so.conf.bak fi # Add entry to first line of /etc/ld.so.conf. sudo sed -i '1 i\ /opt/gtk+-2.12.9/lib' /etc/ld.so.conf sudo ldconfig dialog --title "Setup GTK+-2.12.9" --msgbox "Finished setup. GTK+-2.12.9 is ready for use." 20 50 10 fi |
Code Sample |
#!/bin/bash #Script to unsetup gtk+-2.12.9 #Idea and script by WDef, tweaked for dialog. dialog --title "Deconfigure GTK+-2.12.9" --yesno "This setup will restore your /etc/ld.so.conf file and library linking to the state it was before running the setup menu for GTK+-2.12.9. Do you want to proceed?" 20 50 3 if [ $? = 1 ]; then dialog --title "Deconfigure GTK+-2.12.9" --msgbox "No changes were made. Exiting.." 20 50 10 else # Check for the existance of /etc/ld.so.conf if [ ! -e /etc/ld.so.conf ]; then dialog --title "Deconfigure GTK+-2.12.9" --msgbox "You do not have an /etc/ld.so.conf. Something is very wrong. Exiting.." 20 50 3 exit 1; fi # Check for /etc/ld.so.conf entry. if head -1 /etc/ld.so.conf | grep /opt/gtk+-2.12.9/lib > /dev/null 2>&1; then sudo sed -i 1d /etc/ld.so.conf sudo ldconfig dialog --title "Deconfigure GTK+-2.12.9" --msgbox "/opt/gtk+-2.12.9/lib was removed from the first line of /etc/ld.so.conf and ldconfig was run. Exiting..." 20 50 3 else dialog --title "Deconfigure GTK+-2.12.9" --msgbox "GTK+-2.12.9 is not setup on the system. No changes were made. Exiting..." 20 50 3 # already done exit 1; fi fi |
Quote (Jason W @ May 03 2008,00:58) |
Ok, here is pretty much what i plan to include in the menu - a setup and a remove setup entry. |
Code Sample |
if [ $EUID -ne 0 ];then echo "You're not root, exiting .." exit 1 fi |