#!/bin/sh # Copyright 1994, 1998, 2008 Patrick Volkerding, Moorhead, Minnesota USA # Copyright 2003 Slackware Linux, Inc. Concord, CA USA # Copyright 2009, 2015, 2017, 2018, 2019 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # 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. # # Mon 2 Jul 15:32:14 UTC 2018 # Sort file lists and support SOURCE_DATE_EPOCH, for reproducibility. # # Mon May 21 18:31:20 UTC 2018 # Add --compress option, usually used to change the preset compression level # or block size. # # Tue Feb 13 00:46:12 UTC 2018 # Use recent tar, and support storing POSIX ACLs and extended attributes. # # Tue Dec 12 21:55:59 UTC 2017 # If possible, use multiple compression threads. # # Wed Sep 23 18:36:43 UTC 2015 # Support spaces in file/directory names. # # Sun Apr 5 21:23:26 CDT 2009 # Support .tgz, .tbz, .tlz, and .txz packages. # # Fri Nov 26 13:53:36 GMT 2004 # Patched to chmod 755 the package's root directory if needed, then restore # previous permissions after the package has been created. # # Wed Mar 18 15:32:33 CST 1998 # Patched to avoid possible symlink attacks in /tmp. CWD=$(pwd) umask 022 make_install_script() { TAB="$(echo -e "\t")" COUNT=1 while :; do LINE="$(sed -n "$COUNT p" $1)" if [ "$LINE" = "" ]; then break fi LINKGOESIN="$(echo "$LINE" | cut -f 1 -d "$TAB")" LINKGOESIN="$(dirname "$LINKGOESIN")" LINKNAMEIS="$(echo "$LINE" | cut -f 1 -d "$TAB")" LINKNAMEIS="$(basename "$LINKNAMEIS")" LINKPOINTSTO="$(echo "$LINE" | cut -f 2 -d "$TAB")" echo "( cd $LINKGOESIN ; rm -rf $LINKNAMEIS )" echo "( cd $LINKGOESIN ; ln -sf $LINKPOINTSTO $LINKNAMEIS )" COUNT=$(expr $COUNT + 1) done } usage() { cat << EOF Usage: makepkg package_name.tgz (or: package_name.tbz, package_name.tlz, package_name.txz) Makes a Slackware compatible package containing the contents of the current and all subdirectories. If symbolic links exist, they will be removed and an installation script will be made to recreate them later. This script will be called "install/doinst.sh". You may add any of your own ash-compatible shell scripts to this file and rebuild the package if you wish. options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended) -p, --prepend (prepend rather than append symlinks to an existing doinst.sh. Useful to link libraries needed by programs in the doinst.sh script) -c, --chown y|n (resets all permissions to root:root 755 - not generally recommended) --threads For xz/plzip compressed packages, set the max number of threads to be used for compression. Only has an effect on large packages. For plzip, the default is equal to the number of CPU threads available on the machine. For xz, the default is equal to 2 (due to commonly occuring memory related failures when using many threads with multi-threaded xz compression). --compress