LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-06-2004, 05:46 AM   #16
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612

Yeah great! i just add |cut -f2 -d '=' to that and it gets me what I want.
Does -z do like -v except it eliminates all FIELDS that don't match, or ??
 
Old 06-06-2004, 06:02 AM   #17
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
-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..........
 
Old 06-06-2004, 07:14 AM   #18
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
Re: *** chngcd ***

Quote:
Originally posted by thegeekster
Code:
cat << "__EOF__" > /usr/local/bin/chngcd && chmod 755 /usr/local/bin/chngcd
#!/bin/sh
#*******************************************************************************
# Name: chngcd

# Mount point for CDROM device
CDROM=/mnt/cdrom

umount -l $CDROM 2> /dev/null
eject $CDROM

echo -en "\n After replacing or removing the CD, simply press [Enter]..." \
  && read ans && echo
mount $CDROM 2> /dev/null
__EOF__
It doesn't work because the mount, umount and eject commands are available only for the root user. I prefer sudoing it:
/usr/local/bin/cdrom:
### beginning ###
case "$1" in
'mount')
sudo /sbin/mount /mnt/cdrom/ ;;
'umount')
sudo /sbin/umount /mnt/cdrom/ ;;
*)
echo "Usage $0 mount|umount" ;;
esac
### end ###
And following in my
/etc/sudoers
##begin##
ivanatora ALL=NOPASSWD: /sbin/mount /mnt/cdrom/,/sbin/umount /mnt/cdrom/
##end##
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.
 
Old 06-06-2004, 07:39 AM   #19
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
Re: Re: *** chngcd ***

Quote:
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..................
 
Old 06-06-2004, 09:07 AM   #20
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
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...............
 
Old 06-06-2004, 11:05 AM   #21
usercsr
Member
 
Registered: Sep 2003
Location: Little Rock, Arkansas
Distribution: Slackware-Current
Posts: 129

Rep: Reputation: 15
thanks guys, those are really useful scripts.
 
Old 06-06-2004, 01:02 PM   #22
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Rep: Reputation: 30
Is there a page anywhere out there archiving all the useful bash scripts???

--Akshun J
 
Old 06-06-2004, 04:26 PM   #23
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
Quote:
Originally posted by akshunj
Is there a page anywhere out there archiving all the useful bash scripts???

--Akshun J
By "out there", if you mean on the web, I started this thread a while ago with this mind:

Shell scripts on the web

 
Old 06-06-2004, 05:27 PM   #24
akshunj
Member
 
Registered: Sep 2002
Location: Atlanta, GA
Distribution: Linux Mint Gloria, Slackware 12.2
Posts: 165

Rep: Reputation: 30
Nice. That will get my feet wet. Teaches me to come in at the end of a thread...

--Akshun J
 
Old 06-06-2004, 06:33 PM   #25
Neoslak
LQ Newbie
 
Registered: Nov 2002
Posts: 22

Rep: Reputation: 15
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.

--------------------
#!/bin/sh

for pack in $(ls *.tgz); do
pack=$(basename $pack .tgz)
if [ ! -f /var/log/packages/$pack ]; then
echo "No Package $pack found"
fi
done
------------------

Chuck
 
Old 06-14-2004, 01:56 PM   #26
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
*** whichpkg UPDATE ***

NOTE: This update is superseded by the changes posted here.....

Last edited by thegeekster; 07-08-2004 at 01:48 PM.
 
Old 06-14-2004, 05:36 PM   #27
cassiusclay
LQ Newbie
 
Registered: Jun 2004
Location: Atlanta, GA
Distribution: Slackware and OpenBSD
Posts: 22

Rep: Reputation: 15
moving my post

Last edited by cassiusclay; 06-14-2004 at 07:51 PM.
 
Old 06-15-2004, 12:30 PM   #28
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
I just wanted to say a big THANKS to you geekster! I've been using your scripts a bit and find them very useful
 
Old 07-07-2004, 04:31 AM   #29
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Original Poster
Rep: Reputation: 34
*** 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 02:44 PM.
 
Old 07-07-2004, 04:53 AM   #30
carboncopy
Senior Member
 
Registered: Jan 2003
Location: Malaysia
Posts: 1,210
Blog Entries: 4

Rep: Reputation: 45
Hi! I tested out all three new one but pkginfo seems to be not working properly for me. This is what happens:

Code:
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)...
-------------------------------------------------------------------------------

/var/log/packages/gnome-applets-2.6.1-i486-1
/var/log/packages/gnome-audio-2.0.0-noarch-1
/var/log/packages/gnome-desktop-2.6.2-i486-1
/var/log/packages/gnome-games-2.6.1-i486-3
/var/log/packages/gnome-icon-theme-1.2.3-noarch-1
/var/log/packages/gnome-keyring-0.2.1-i486-1
/var/log/packages/gnome-media-2.6.2-i486-1
/var/log/packages/gnome-mime-data-2.4.1-noarch-1
/var/log/packages/gnome-netstatus-2.6.1-i486-1
/var/log/packages/gnome-panel-2.6.2-i486-1
/var/log/packages/gnome-session-2.6.2-i486-1
/var/log/packages/gnome-speech-0.3.3-i486-1
/var/log/packages/gnome-system-monitor-2.6.0-i486-1
/var/log/packages/gnome-terminal-2.6.1-i486-1
/var/log/packages/gnome-themes-2.6.2-i486-1
/var/log/packages/gnome-themes-extras-0.7-i486-1
/var/log/packages/gnome-utils-2.6.2-i486-1
/var/log/packages/gnome-vfs-2.6.1.1-i486-2
/var/log/packages/libgail-gnome-1.0.4-i486-1

-------------------------------------------------------------------------------
 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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware-Current & Custom Compile slaxnoob Slackware 2 01-12-2010 01:40 PM
Custom cups printers in slackware bman2 Slackware 0 10-10-2005 07:59 PM
Slackware 10.1 installation with custom build kernel zWaR Slackware 5 08-09-2005 02:29 AM
Installing Slackware CD 9.1 using custom kernel (sata) bonecrusher Slackware - Installation 7 04-07-2004 01:34 AM
build custom slackware iso Zeratool Box Slackware 1 05-11-2003 01:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration