SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
-z is for testing empty strings.................in this case, the test is for NOT an empty string [ ! -z ... ], and by using the 'for' statement, it breaks up the input from the 'cat' command whenever 'for' parses any whitespace (blank spaces, tabs) or newlines, thereby letting you test each space-delimited field separately..........
cat << "__EOF__" > /usr/local/bin/chngcd && chmod 755 /usr/local/bin/chngcd
# Name: chngcd
# Mount point for CDROM device
umount -l $CDROM 2> /dev/null
echo -en "\n After replacing or removing the CD, simply press [Enter]..." \
&& read ans && echo
mount $CDROM 2> /dev/null
It doesn't work because the mount, umount and eject commands are available only for the root user. I prefer sudoing it:
### beginning ###
case "$1" in
sudo /sbin/mount /mnt/cdrom/ ;;
sudo /sbin/umount /mnt/cdrom/ ;;
echo "Usage $0 mount|umount" ;;
### end ###
And following in my
ivanatora ALL=NOPASSWD: /sbin/mount /mnt/cdrom/,/sbin/umount /mnt/cdrom/
Of course 'ivanatora' is my username, so if you want this to work you should change this. It can be easily modified to eject the cdrom, but I can't see the point.
Originally posted by ivanatora It doesn't work because the mount, umount and eject commands are available only for the root user...
Not on my machine...............those commands are in bin directories, not sbin directories................if you have problems, then it's probably a matter of how you're permissions are set for the CDROM device.............usually, the CDROM is set for anyone to mount and unmount..............otherwise CDROMs wouldn't be very useful for users..................
If anyone is having problems, there are two ways to overcome it....................either add the user to the same group as the block device ("disk" for Slackware), or change the permissions on the block device to make it readable for "others", ie., brw-r--r--
If you add the user to the same group as the block device for the CDROM, you might have to logout completely or reboot the machine...............
Here is a useful, if totally simplistic script, that is handy to see what Slackware packages in a given directory are *not* installed. For instance, I keep a local mirror of Slackware-current and I want to know if there are any packages in my slackware-current/slackware/gnome directory that are not already installed. I put a copy of this script in /usr/local/bin and change to /home/ftp/pub/slackware-current/slackware/gnome and run packcheck.sh. If anybody wants to improve on this, post your improvements here.
for pack in $(ls *.tgz); do
pack=$(basename $pack .tgz)
if [ ! -f /var/log/packages/$pack ]; then
echo "No Package $pack found"
*** FINAL UPDATES for lspkg, whichpkg, and pkginfo ***
Okay, I think I've gone about as far as I can with these three scripts, lspkg, whichpkg, and pkginfo................They are all converted over from using regular expression syntax to wildcard matching (globbing). While not true globbing, they are close enough for practical purposes here...........If you're interested knowing what the difference is, read the manpages for globbing and regular expressions, 'man 7 glob' and 'man 7 regexp'. (Note - For KDE users, you can view the manpages in a html format by entering these urls in Konqueror, 'man:/glob(7)' and 'man:/regexp(7)'. This only works in Konqueror, not any other browser in KDE.).......Be sure to include the number 7 in both............
I did a major overhaul for the whichpkg script, making it easier to read the output, filtering out more of the unwanted garbage, and allowing for multiple search terms. It ended up being a bit of a challenge, more than I had anticipated....... ..........but I think I've got it right (it sure did sharpen my regexp skills.......LOL).............A few search terms were quite unpredictable, most notably the searches for "ln", "file", "install" and "sh"...........If there are others you come across which seem not quite right, be sure to post them here and I'll fix it. otherwise this is pretty much the final update.
The other two were mostly to convert to using wildcard searching (pkginfo) or a minor change in the usage of the wildcards in the search term (lspkg)..........Again, I don't see where they can go much farther, so these will also be the final updates.
HOWEVER................I'm going to create another Slackware specific script to deal with orphaned files by looking at all the system files and matching them against the list of files found in the /var/log/packages/ and /var/log/scripts/ directories..............Then you will be presented with a report of all the files that aren't accounted for from the installed packages..............Some of these may be from various scripts and files you may have added manually, such as these scripts, but some may be leftovers from old installations no longer around.................Either way, you will have a list to look over and decide for yourself whether they belong there or not..............The reason for this script is from some of the posts I've seen recently asking about what files are safe to remove, or a way to determine which files are not wanted or needed...........I do love a challenge.............
Okay, enought talk, the changes have already been made in the top post (post #1) above....
EDIT: Changed line number 53 in "pkginfo" script by removing the path "/var/log/packages/" (The third line from the end, above the two "esac" lines). Thanks goes to carboncopy for pointing out this error.
EDIT2: More changes needed in the "pkginfo" script as noted below.
Last edited by thegeekster; 07-08-2004 at 03:44 PM.
Hi! I tested out all three new one but pkginfo seems to be not working properly for me. This is what happens:
bash-2.05b# ./pkginfo gnome
More than one package was found matching the name, "gnome".
Choose a package from the following list (Hint: Use the mouse to copy-n-paste
the desired package name)...
Enter package name here: gnome-audio
cat: /var/log/packages//var/log/packages/gnome-audio-2.0.0-noarch-1: No such file or directory