diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-07-31 20:54:39 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-07-31 20:54:39 +0000 |
commit | 546354758b9a532912651b047fab6a23f0cb0a3c (patch) | |
tree | c4108b4022d6e77cd4a1d02c78860b884178efa0 /lspkg | |
download | simplepkg-546354758b9a532912651b047fab6a23f0cb0a3c.tar.gz simplepkg-546354758b9a532912651b047fab6a23f0cb0a3c.tar.bz2 |
initial import
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@1 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'lspkg')
-rwxr-xr-x | lspkg | 68 |
1 files changed, 68 insertions, 0 deletions
@@ -0,0 +1,68 @@ +#!/bin/bash +# +# lspkg v0.2: view installed and contents of +# slackware packages +# +# feedback: rhatto at riseup.net | gpl +# +# Lspkg is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. +# +# Lspkg is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# +# +# -v, --view: view installed package contents +# -p, --print: print the contents of a package file +# -r, --remove: remove matching packages +# -s, --search: search a file under installed packages +# +# todo: +# +# -d, --description: show matching packages' descriptions +# -h, --help: show usage +# + +function usage { + echo "usage: $0 [-v|-d|-s|-p expression]" + exit 1 +} + +if [[ "$1" = "-v" ]]; then + if [[ ! -z "$2" ]]; then + if $(ls /var/log/packages/$2* &> /dev/null); then + for file in $(ls /var/log/packages/$2*); do + less $file + done + else echo $2: package not found on /var/log/packages + fi + else + usage + fi +elif [[ "$1" = "-p" ]]; then + if [ -f $2 ]; then + tar ztvf $2 + else echo $2: file not found + fi +elif [[ "$1" == "-r" ]]; then + if [ ! -z "$2" ]; then + if `ls /var/log/packages/$1* &> /dev/null`; then + removepkg /var/log/packages/$1* + fi + fi +elif [[ "$1" == "-s" ]]; then + if [[ ! -z "$2" ]]; then + grep $2 /var/log/packages/* + fi +else + if `ls /var/log/packages/$1* &> /dev/null`; then + ls /var/log/packages/$1* + else echo $1: package not found on /var/log/packages + fi +fi |