Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (23) </ ... 14 15 16 17 18 [19] 20 21 22 23 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: April extensions< Next Oldest | Next Newest >
Jason W Offline





Group: Members
Posts: 260
Joined: Nov. 2006
Posted: April 30 2008,23:52 QUOTE

Thanks for your input and scripts.  I did not realize how many apps in base were linked to the gtk+-2.12.9 libs when the extension was loaded.  And nothing seems broken, except for /usr/bin/fc-cache that gives an error about scanning directories.  I will put a menu extension to automate the configuration.
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: May 01 2008,16:04 QUOTE

Jason: in that setup script, which I didn't actually test until now, cp complains about overwriting a symlink with its target even with the force option, so I've:

- edited it to remove the target  before copying.
- only need a backup of the file if it isn't a symlink - changed.

So suggest using the updated version.
Back to top
Profile PM 
Jason W Offline





Group: Members
Posts: 260
Joined: Nov. 2006
Posted: May 03 2008,00:58 QUOTE

Ok, here is pretty much what i plan to include in the menu - a setup and a remove setup entry.  The setup:

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



The unsetup:


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


Seems to work and make things easier.   Thanks again.
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: May 03 2008,06:42 QUOTE

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.

Some comments after a glance at the code:

- are you sure you want to only look at the first line? What if other extensions want to do something similar, etc.?
- the grep line may work, but it's actually checking wildcards.  You'd need to escape it, or use -F, etc. and use anchors.  A better way may be to use test (i.e. if [ `command` = "this" ]; then ) while (maybe) saving on some trivial resources
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: May 03 2008,14:16 QUOTE

Good to use dialog to inform the user something's happened (see the loop-aes extension module setup script for something similar).

I'd probably just call it with sudo from the menu and save typing redundant sudos everywhere (less clutter is usually good practice).  If you are concerned non-X users might run it as ordinary user and wonder why it's broken, the usual thing is test if it's being run with root rights at the beginning:

Code Sample
if [ $EUID -ne 0 ];then
      echo "You're not root, exiting .."
      exit 1
fi


But it doesn't really matter much, whatever you' re happy with.
Back to top
Profile PM 
111 replies since April 05 2008,18:24 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (23) </ ... 14 15 16 17 18 [19] 20 21 22 23 >/
reply to topic new topic new poll
Quick Reply: April extensions

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code