sbotools2

Maintenance fork of the original sbotools version 2
git clone git://git.server.ky/slackcoder/sbotools2
Log | Files | Refs | README

installpkg (2421B)


      1 #!/bin/bash
      2 
      3 # Stripped down and useless version of this script merely used for testing.
      4 # But some bits taken from the original upgradepkg, so here's its copyright
      5 # notice.
      6 
      7 # Copyright 1999  Patrick Volkerding, Moorhead, Minnesota, USA
      8 # Copyright 2001, 2002, 2003  Slackware Linux, Inc., Concord, California, USA
      9 # Copyright 2009, 2015  Patrick J. Volkerding, Sebeka, MN, USA
     10 # Copyright 2015  Michal Nazarewicz <mina86@mina86.com>
     11 # All rights reserved.
     12 #
     13 # Redistribution and use of this script, with or without modification, is
     14 # permitted provided that the following conditions are met:
     15 #
     16 # 1. Redistributions of this script must retain the above copyright
     17 #    notice, this list of conditions and the following disclaimer.
     18 #
     19 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     20 #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     21 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
     22 #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23 #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     24 #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     25 #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     26 #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     27 #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     28 #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29 #
     30 # Modified to handle either old 8.3 or new package-version-arch-build.tgz
     31 # packages, Sat Nov 17 14:25:58 PST 2001 volkerdi
     32 #
     33 # Rewritten to clean out _all_ old packages of a given basename, not just
     34 # the first one found, Thu Apr  4 01:01:05 PST 2002 volkerdi
     35 #
     36 # Added --install-new and --reinstall, Fri May 31 14:11:14 PDT 2002 volkerdi
     37 # Added --dry-run, Sat Apr 26 18:13:29 PDT 2003
     38 #
     39 # Sat Apr 25 21:18:53 UTC 2009
     40 # Support new compression types and package extensions.
     41 # Converted to use new pkgbase() function to remove pathname and
     42 # valid package extensions.
     43 #
     44 # Sat 17 Jan 16:21:32 UTC 2015  mina86
     45 # Various optimisation mostly resolving around avoiding having to fork
     46 # and call cut, basename and other helper commands.  Slight
     47 # refactoring of code calling removepkg.
     48 
     49 pkgbase() {
     50   PKGRETURN=${1##*/}
     51   case "$PKGRETURN" in *.t[gblx]z)
     52     PKGRETURN=${PKGRETURN%.*}
     53   esac
     54   echo "$PKGRETURN"
     55 }
     56 
     57 touch /var/log/packages/$(pkgbase $1)