Wednesday, December 3, 2008

I received this comment and felt it warranted a revised script on my blog.
Blogger kdulcimer said...

There's one issue with your script: anything coded for PCLinuxOS shouldn't use sudo! PCLinuxOS isn't set up for sudo. You should have your script check to make sure it's being run as root instead


Thanks for the input. I setup my pclos install to use sudo out of habit. All it takes is to edit the sudoers file with visudo and add the user like so.

# su -
# visudo

Then edit the user privelege specification so it looks something like this.

"# User privilege specification
root ALL=(ALL) ALL
mini ALL=(ALL) ALL"

Where mini is the name of the user. Substitute your user name of course.

type "wq!" to save and exit and sudo is setup!

Revising the script to your specs would look something like this. With files downloaded and compiled in /tmp. It checks to see if the user is root and if not, then exits.

if [ "$UID" != "0" ]; then
echo The mplayer installation requires root privileges.
echo Please login as root, and run:
echo again
echo Press ENTER to continue...
read dummy
exit 0

#compile smake for pclos

cd /tmp
tar -zxf smake-1.2a41.tar.gz
cd smake-1.2
cp Gmake.linux /usr/bin/Gmake
cp /opt/schily/bin/smake /usr/bin
chmod +x /usr/bin/smake

#compile cdrtools for pclos
cd /tmp
tar -zxf cdrtools-beta.tar.gz
cd cdrtools-2.01.01
smake install

# Ensure root ownership for proper operation
chown root:root /opt/schily/bin/*

# Backup cdrkit files
cd /tmp
mkdir cdrkitbackup
mv /usr/bin/wodim /tmp/cdrkitbackup
mv /usr/bin/readom /tmp/cdrkitbackup
mv /usr/bin/genisoimage /tmp/cdrkitbackup
mv /usr/bin/btcflash /tmp/cdrkitbackup
mv /usr/bin/devdump /tmp/cdrkitbackup
mv /usr/bin/isodump /tmp/cdrkitbackup
mv /usr/bin/isodebug /tmp/cdrkitbackup
mv /usr/bin/isoinfo /tmp/cdrkitbackup
mv /usr/bin/isovfy /tmp/cdrkitbackup
mv /usr/bin/icedax /tmp/cdrkitbackup

# Remove soft links to cdrkit programs
rm /usr/bin/cdrecord
rm /usr/bin/cdda2wav
rm /usr/bin/mkhybrid
rm /usr/bin/mkisofs
rm /usr/bin/readcd

# Create soft links to cdrtools programs
# Create soft links to cdrkit naming conventions for compatibility
ln -s /opt/schily/bin/cdrecord /usr/bin/cdrecord
ln -s /opt/schily/bin/cdrecord /usr/bin/wodim
ln -s /opt/schily/bin/mkisofs /usr/bin/genisoimage
ln -s /opt/schily/bin/mkisofs /usr/bin/mkisofs
ln -s /opt/schily/bin/mkhybrid /usr/bin/mkhybrid
ln -s /opt/schily/bin/readcd /usr/bin/readom
ln -s /opt/schily/bin/readcd /usr/bin/readcd
ln -s /opt/schily/bin/cdda2wav /usr/bin/cdda2wav
ln -s /opt/schily/bin/cdda2wav /usr/bin/icedax
ln -s /opt/schily/bin/btcflash /usr/bin/btcflash
ln -s /opt/schily/bin/isodebug /usr/bin/isodebug
ln -s /opt/schily/bin/isodump /usr/bin/isodump
ln -s /opt/schily/bin/isoinfo /usr/bin/isoinfo
ln -s /opt/schily/bin/isovfy /usr/bin/isovfy

No comments: