aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/lib')
-rw-r--r--trunk/lib/common.sh52
1 files changed, 11 insertions, 41 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index f83e761..658c66d 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -1,30 +1,19 @@
#!/bin/bash
#
# common.sh: common functions for simplepkg
-# feedback: rhatto at riseup.net | gpl
+# feedback: rhatto at riseup.net
#
-# Uses some functions from pkgtools, which license is:
+# common.sh 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.
#
-# Copyright 1999 Patrick Volkerding, Moorhead, Minnesota, USA
-# Copyright 2001, 2002, 2003 Slackware Linux, Inc., Concord, California, USA
-# All rights reserved.
+# common.sh 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.
#
-# Redistribution and use of this script, with or without modification, is
-# permitted provided that the following conditions are met:
-#
-# 1. Redistributions of this script must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 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
#
BASE_CONF="/etc/simplepkg"
@@ -38,26 +27,7 @@ SIMPLARET="simplaret"
function package_name {
- STRING=`basename $1 .tgz`
- # Check for old style package name with one segment:
- if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then
- echo $STRING
- else # has more than one dash delimited segment
- # Count number of segments:
- INDEX=1
- while [ ! "`echo $STRING | cut -f $INDEX -d -`" = "" ]; do
- INDEX=`expr $INDEX + 1`
- done
- INDEX=`expr $INDEX - 1` # don't include the null value
- # If we don't have four segments, return the old-style (or out of spec) package name:
- if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then
- echo $STRING
- else # we have four or more segments, so we'll consider this a new-style name:
- NAME=`expr $INDEX - 3`
- NAME="`echo $STRING | cut -f 1-$NAME -d -`"
- echo $NAME
- fi
- fi
+ echo "`basename $1 .tgz`" | sed -e 's/-[^-]*-[^-]*-[^-]*$//'
}