#!/bin/sh # This short script checks if installing a package will overwrite any files # on the system. # It should output directories, but any FILES it lists are the ones that will # be overwritten # The doinst.sh, if present, is also outputted to stdout for the admin to # review. # USAGE: slackbuild_sanity.sh /path/to/package.tgz # # Written by Phillip Warner # Make sure we have an input arg and that it is a gzip file/archive if [ -z $1 ] || [ $(file $1 | grep -c 'gzip compressed data') -ne 1 ] then echo "USAGE: $0 /path/to/package.tgz" exit 1 fi # Make sure it is actually a Slackware package if ! $(tar -tf $1 install/slack-desc &> /dev/null) then echo "$1 has gzip compressed data, but it is NOT a slackware package!" exit 1 fi for i in `tar tzf $1` do if [ -e "/$i" ]; then if [ ! -d "/$i" ]; then echo -n "*" else echo -n " " fi echo "found" $i fi done echo echo "Outputting contents of doinst.sh" # Test for doinst.sh tar ztf $1 install/doinst.sh &> /dev/null # If it is there then cat it to stdout if [ $? == 0 ]; then tar -zxO install/doinst.sh -f $1 else echo "doinst.sh not found" fi