Files
archie/scripts/untar
Mario Fetka 1e4baef047 Port Archie 3.5 to Linux/CMake, add Debian packaging and CI
- Replace autoconf/make build system with CMake (installs to /opt/archie)
- Add CPack DEB packaging for Debian Trixie (non-free/net, postinst creates
  archie user, extracts DB skeleton, sets setuid bits, enables systemd units)
- Add Gitea Actions workflow building .deb + binary/source tarballs on tag push
- Add portable archie_init.py for non-Debian post-install setup
- Port all scripts to Linux: getent passwd, systemctl, tail -n +N, gzip
- Add SFTP (libssh2) and FTPS (OpenSSL) scrapers alongside anonftp
- Add Flask web frontend (archie-web.service)
- Fix filter scripts (exec cat replaces broken sed s///g)
- Update all manpages: paths, contacts, add SFTP/FTPS section
- Update etc/: enable gzip, add webindex catalog, fix localhost refs
- Remove: AIX-2/SunOS-4.1.4/SunOS-5.4 dirs, tcl7.6/, tcl-dp/, tk4.2/,
  berkdb/, old Makefile.in/pre/post fragments, build.sh, unwrap scripts
- Add .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 23:05:12 +02:00

99 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
#
# Untar a file safely by making backup of the files your are about to
# overwrite.
#
# 1994 (c) Regents of McGill University, School of Computer Science.
# by Luc Boulianne (lucb@cs.mcgill.ca)
#
usage () {
echo "Usage $0 [-v] [-d directory] tarfile.gz"
echo "Untar files safely by making backup of the files you"
echo "are about to overwrite."
echo "options: "
echo " [-d] cd to this directory before untarring"
echo " [-v] set debugging on"
echo " [-h] this help info"
echo ""
exit 2
}
# parse the command line arguments:
#
while [ $# -gt 1 ] ; do
case $1 in
-d) shift; directory=$1;;
-v) debug="y" ;;
-h) usage;; # call the usage funtion
*) # Catch anything that doesn't match the
# previous flags
echo "Unknown option [$1]";
usage;;
esac
shift
done
umask 000
MV=/bin/mv
TAR=tar
GZIP=gzip
MIDX=9;
# For solaris ...
PATH=$PATH
echo "Untarring $1 in the ${directory:=.} directory.";
index()
{
i=1;
while [ $i -le ${1:-$MIDX} ] ; do
echo -n "$i ";
i=`expr $i + 1`;
done
}
rindex()
{
i=${1:-$MIDX};
while [ $i -gt 0 ] ; do
echo -n "$i ";
i=`expr $i - 1`;
done
}
rotate()
{
fn=$1;shift;
for n in $* ; do
src=$fn.`expr $n - 1`
dest=$fn.$n
test -f $src && $MV -f $src $dest && echo " - $MV -f $src $dest"
done
test -f $fn && $MV -f $fn $fn.0 && echo " - $MV -f $fn $fn.0"
}
idx=`rindex`;
if [ x${debug:-x} = yx ] ; then
set -x;
fi
echo ""
echo "Uncompressing the tar file - this will take a moment..."
echo ""
echo "Note: Please do not interrupt while files are being rotated."
echo " The simple script, \`unrotate' has been supplied to unrotate files in"
echo " a given directory, should something go wrong."
echo ""
$GZIP -d < $1 | $TAR -tf - | while read file
do
cd $directory
echo $file
test -f $file && rotate $file $idx && echo "Rotated old file $file"
done
$GZIP -d < $1 | (cd $directory ; $TAR -xvpf - )