Files
archie/scripts/unrotate
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

94 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#
#
# 1994 (c) Regents of McGill University, School of Computer Science.
# by Luc Boulianne (lucb@cs.mcgill.ca)
#
usage () {
cat - <<EOC
Usage: $0 [-h] [-v] files.[0-9]
Interactively, unrotate a group of files in the current directory. You must
supply only one copy of the filename group you want to unrotate. If you
don't, a set of files will be unrotated twice.
Options:
[-v] set debugging on
[-h] this help info
EOC
exit 2
}
# parse the command line arguments:
#
if [ $# -gt 0 ] ; then
case $1 in
-v) debug="y" ; shift;;
-h) usage;; # call the usage funtion
-*) # Catch anything that doesn't match the
# previous flags
echo "Unknown option [$1]";
usage;;
esac
fi
MV=/bin/mv
TAR=tar
GZIP=gzip
MIDX=9;
# For solaris ...
PATH=$PATH
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
}
unrotate()
{
fn=$1;shift;
test -f $fn && $MV -f $fn $fn.new && echo $MV -f $fn $fn.new
test -f $fn.0 && $MV -f $fn.0 $fn && echo $MV -f $fn.0 $fn
for n in $* ; do
echo [$n]
dest=$fn.`expr $n - 1`
src=$fn.$n
test -f $src && $MV -f $src $dest && echo $MV -f $src $dest
done
}
idx=`index`;
if [ x${debug:-x} = yx ] ; then
set -x;
fi
for i do
file=`echo $i | sed 's/\.[0-9]$//'`
echo ${file}*
echo -n "Proceed with the unrotation of the [${file}*] group of files? [n] "
read ans
if [ x$ans = xy ] ; then
unrotate $file $idx && echo "Unrotated files ${file}*"
fi
done