From 198320040333ec8dcc144b9fa92e169c660bf79b Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 4 Jun 2013 23:46:21 -0400 Subject: [PATCH] hv-utilities is now fetched and installed like all other packages --- config/packages-list | 1 + stage2/hv-install-2 | 3 +- stage2/hv-utilities/backup.conf | 7 - stage2/hv-utilities/camera-download | 52 --- stage2/hv-utilities/cd-copy | 26 -- stage2/hv-utilities/cd-erase | 38 --- stage2/hv-utilities/cgrep | 16 - stage2/hv-utilities/crypt.pl | 16 - stage2/hv-utilities/distro-backup | 13 - stage2/hv-utilities/dos2unix | 35 -- stage2/hv-utilities/fix-avi | 149 --------- stage2/hv-utilities/flac2mp3 | 46 --- stage2/hv-utilities/flac2ogg | 44 --- stage2/hv-utilities/gztobz2 | 49 --- stage2/hv-utilities/hv-backup | 91 ------ stage2/hv-utilities/hv-scan | 77 ----- stage2/hv-utilities/hv-video-dvd | 140 -------- stage2/hv-utilities/mail-files | 307 ------------------ stage2/hv-utilities/mail-if-fail | 34 -- stage2/hv-utilities/mail-statistics | 50 --- stage2/hv-utilities/media-write | 157 --------- stage2/hv-utilities/pstopdf | 37 --- stage2/hv-utilities/replace.pl | 44 --- stage2/hv-utilities/rotatelogs | 98 ------ stage2/hv-utilities/setdate | 6 - stage2/hv-utilities/strip-debug-symbols | 2 - stage2/hv-utilities/tape-backup/tape-backup | 91 ------ .../hv-utilities/tape-backup/tape-backup-mult | 87 ----- stage2/hv-utilities/tape-backup/tape-list | 75 ----- stage2/hv-utilities/tape-backup/tape-restore | 36 -- stage2/hv-utilities/tarbz2 | 26 -- stage2/hv-utilities/tildes-clean | 64 ---- stage2/hv-utilities/vd | 25 -- stage2/hv-utilities/vl | 32 -- stage2/hv-utilities/vs | 37 --- stage2/install-hv-utilities | 26 -- stage2/packages-update | 1 + stage2/pkg/hv-utilities | 8 + 38 files changed, 12 insertions(+), 2034 deletions(-) delete mode 100755 stage2/hv-utilities/backup.conf delete mode 100755 stage2/hv-utilities/camera-download delete mode 100755 stage2/hv-utilities/cd-copy delete mode 100755 stage2/hv-utilities/cd-erase delete mode 100755 stage2/hv-utilities/cgrep delete mode 100755 stage2/hv-utilities/crypt.pl delete mode 100755 stage2/hv-utilities/distro-backup delete mode 100755 stage2/hv-utilities/dos2unix delete mode 100755 stage2/hv-utilities/fix-avi delete mode 100755 stage2/hv-utilities/flac2mp3 delete mode 100755 stage2/hv-utilities/flac2ogg delete mode 100755 stage2/hv-utilities/gztobz2 delete mode 100755 stage2/hv-utilities/hv-backup delete mode 100755 stage2/hv-utilities/hv-scan delete mode 100755 stage2/hv-utilities/hv-video-dvd delete mode 100755 stage2/hv-utilities/mail-files delete mode 100755 stage2/hv-utilities/mail-if-fail delete mode 100755 stage2/hv-utilities/mail-statistics delete mode 100755 stage2/hv-utilities/media-write delete mode 100755 stage2/hv-utilities/pstopdf delete mode 100755 stage2/hv-utilities/replace.pl delete mode 100755 stage2/hv-utilities/rotatelogs delete mode 100755 stage2/hv-utilities/setdate delete mode 100755 stage2/hv-utilities/strip-debug-symbols delete mode 100755 stage2/hv-utilities/tape-backup/tape-backup delete mode 100755 stage2/hv-utilities/tape-backup/tape-backup-mult delete mode 100755 stage2/hv-utilities/tape-backup/tape-list delete mode 100755 stage2/hv-utilities/tape-backup/tape-restore delete mode 100755 stage2/hv-utilities/tarbz2 delete mode 100755 stage2/hv-utilities/tildes-clean delete mode 100755 stage2/hv-utilities/vd delete mode 100755 stage2/hv-utilities/vl delete mode 100755 stage2/hv-utilities/vs delete mode 100755 stage2/install-hv-utilities create mode 100644 stage2/pkg/hv-utilities diff --git a/config/packages-list b/config/packages-list index 0bb9368..6c7a2d5 100644 --- a/config/packages-list +++ b/config/packages-list @@ -165,6 +165,7 @@ HELP2MAN="help2man-1.37.1" HICOLOR_ICON_THEME="hicolor-icon-theme-0.12" HTTPD="httpd-2.4.3" HVCLOCK="hvclock-1.0.2" +HV_UTILITIES="hv-utilities-0.1.0" IANA="iana-etc-2.30" ICON_NAMING_UTILS="icon-naming-utils-0.8.90" diff --git a/stage2/hv-install-2 b/stage2/hv-install-2 index 43eb6e4..06651f5 100755 --- a/stage2/hv-install-2 +++ b/stage2/hv-install-2 @@ -55,9 +55,10 @@ fi ipkg ${NANO} ipkg -m noac ${ACPID} +ipkg ${HV_UTILITIES} "--prefix=/usr/local" + ipkg -c -m noac -l "kernel" -s "kernel" ${KERNEL} -rscr once "Installing HV-utilities" install-hv-utilities rscr once "Installing bootscripts" install-bootscripts rscr once "Creating default config files" create-config-files diff --git a/stage2/hv-utilities/backup.conf b/stage2/hv-utilities/backup.conf deleted file mode 100755 index 6fab501..0000000 --- a/stage2/hv-utilities/backup.conf +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# List of files/directories to backup -BKP_FILES_LIST="/etc /root /srv /usr/local/bin" - -# Where to put backup -BKP_DEST_DIR="/mnt/nas/backup" diff --git a/stage2/hv-utilities/camera-download b/stage2/hv-utilities/camera-download deleted file mode 100755 index 5734b67..0000000 --- a/stage2/hv-utilities/camera-download +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -PROG_NAME=$(basename $0) - -MOUNTPOINT=/media/camera -DIRNAME=$(date +%Y%m%d-%Hh%M) - -print_usage() -{ - echo "Usage: ${PROG_NAME} [OPTION]..." - echo - echo "Copy and delte images from digital camera." - echo - echo "Options:" - echo " -h display this help and exit" - exit 0 -} - -while getopts "h" flag ;do - case ${flag} in - h) - print_usage - ;; - ?) - echo "${PROG_NAME}: Invalid option: ${OPTARG}." - echo "Try \`${PROG_NAME} -h' for more information." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -ne 0 ]; then - echo "${PROG_NAME}: Too many arguments." - echo "Try \`${PROG_NAME} -h' for more information." - exit 1 -fi - - -if ! mount | grep -q ${MOUNTPOINT}; then - mount ${MOUNTPOINT} || exit 1 -fi - -mkdir -p ~/camera/${DIRNAME} && - -mv ${MOUNTPOINT}/dcim/???_???? ~/camera/${DIRNAME} - -umount /media/camera - -exit $? diff --git a/stage2/hv-utilities/cd-copy b/stage2/hv-utilities/cd-copy deleted file mode 100755 index 166698e..0000000 --- a/stage2/hv-utilities/cd-copy +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# cd-copy: CD to CD copy - -# Load configuration informations about device -. /etc/sysconfig/cdrecord - -print_usage() -{ - echo "Usage: $(basename $0)" -} - -if [ $# != 0 ]; then - print_usage - exit 1 -fi - -if [ "x${CDROM_DEVICE}" != "x${CDREC_DEVICE}" ];then - CDRDAO_OPTS="--on-the-fly" -fi - -cdrdao copy ${CDRDAO_OPTS} \ - --source-device ${CDROM_DEVICE} \ - --device ${CDREC_DEVICE} ${CDRECORD_OPTS} --eject - -exit $? diff --git a/stage2/hv-utilities/cd-erase b/stage2/hv-utilities/cd-erase deleted file mode 100755 index 74930c2..0000000 --- a/stage2/hv-utilities/cd-erase +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# cd-erase - -# Load configuration informations about device -. /etc/sysconfig/cdrecord - -print_usage() -{ - echo "Usage: $(basename $0) {all|fast|session}" -} - -if [ $# = 0 -o $# -gt 1 ]; then - print_usage - exit 1 -fi - -ERASE_TYPE=${1} - -case "${ERASE_TYPE}" in - all) - ;; - - fast) - ;; - - session) - ;; - - *) - print_usage - exit 1 - ;; -esac - -cdrecord ${CDRECORD_OPTS} dev=${CDREC_DEVICE} blank=${ERASE_TYPE} - -exit $? diff --git a/stage2/hv-utilities/cgrep b/stage2/hv-utilities/cgrep deleted file mode 100755 index 84be2f1..0000000 --- a/stage2/hv-utilities/cgrep +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -print_usage() -{ - echo "$(basename $0) -- Grep and Less front end." - echo "Usage: $(basename $0) GREP_STRING" -} - -if [ $# -ne 1 ]; then - print_usage - exit 1 -fi - -GREP_STRING=${1} - -grep --color=always -rn "${GREP_STRING}" * | less -RFX diff --git a/stage2/hv-utilities/crypt.pl b/stage2/hv-utilities/crypt.pl deleted file mode 100755 index 0b67a68..0000000 --- a/stage2/hv-utilities/crypt.pl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl - -# Taken from http://rasterweb.net/raster/code/crypt.html -# -# I needed this for creating shadow passwords under Red Hat Linux 6.1, since -# passwords are not stored in plain text (that's a good idea) if I remember -# correctly, Red Hat had broken useradd, or adduser, or whatever the hell they -# were using at the time... - -srand (time()); -my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))"; -my $salt = sprintf ("%c%c", eval $randletter, eval $randletter); -my $plaintext = shift; -my $crypttext = crypt ($plaintext, $salt); - -print "${crypttext}\n"; diff --git a/stage2/hv-utilities/distro-backup b/stage2/hv-utilities/distro-backup deleted file mode 100755 index 006ab2b..0000000 --- a/stage2/hv-utilities/distro-backup +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# linux HV backup - -export MEDIA_DEV="/dev/dvd" -export MEDIA_DIR="/media/dvd" - -export BKP_TMP_DIR=/mnt/video/tmp -BKP_FILES_LIST="/bin /boot /dev /etc /home /lib /opt /root /sbin /var /usr" - -media-write ${BKP_FILES_LIST} - -exit $? diff --git a/stage2/hv-utilities/dos2unix b/stage2/hv-utilities/dos2unix deleted file mode 100755 index aca541a..0000000 --- a/stage2/hv-utilities/dos2unix +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -print_usage() -{ - echo "$(basename $0) -- Translates multiple DOS text file to UNIX." - echo "Usage: $(basename $0) dos-text-file" -} - -if [ $# = 0 ]; then - print_usage - exit 1 -fi - -TMPFILE="/tmp/dos2unix$$" - -while [ $# -ne 0 ]; do - # Checking if input file exist. - if [ ! -f $1 ]; then - echo "$0: File $1 not found." - print_usage - exit 1 - fi - # DOS files lines ends with CR+LF. Unix files lines ends with LF. - # Removing CR from DOS file (CR is 0x0D --> 015 in octal notation). - tr -d '\015' < $1 > $TMPFILE - if [ $? -eq 0 ] ; then - # Success - mv $TMPFILE $1 - fi - shift -done - -if [ -f $TMPFILE ]; then - rm $TMPFILE -fi diff --git a/stage2/hv-utilities/fix-avi b/stage2/hv-utilities/fix-avi deleted file mode 100755 index 0462a62..0000000 --- a/stage2/hv-utilities/fix-avi +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash -# -# A script to correct the resolution of an AVI file and -# make a DVD without any stretching or squashing -# - -# NTSC values -dvd_width=720 -dvd_height=480 - -# Precision of computations -BC_SCALE=10 - -print_usage() -{ - echo "Usage: ${PROG_NAME} [OPTION]... WIDTHxHEIGHT" - echo - echo "Outputs ffmpeg options to correctly convert an AVI file," - echo "of width WIDTH and height HEIGHT, for creating a" - echo "video DVD." - echo - echo "Options:" - echo " -h display this help and exit" - echo " -w output in widescreen format (preferred)" - echo " -v verbose output" - echo - echo "When encoding to a 16:9 aspect MPEG (*see note below*)" - echo " -Source NTSC/PAL NTSC/PAL NTSC/PAL -Aspect CVD SVCD DVD - 4:3 Not Applicable: See above table for 1.33 resolutions - -16:9 *352x480 / *352x576 *480x480 / *480x576 352x480 / 352x576 704x480 / 704x576 720x480 / 720x576 - -1.85 *352x460 / *352x552 *480x460 / *480x552 352x460 / 352x552 704x460 / 704x552 720x460 / 720x552 - -2.20 *352x388 / *352x432 *480x388 / *480x464 352x388 / 352x464 704x388 / 704x464 720x388 / 720x464 - -2.35 *352x360 / *352x432 *480x360 / *480x432 352x360 / 352x432 704x360 / 704x432 720x360 / 720x432" -} - -#dvd_dar this is either 16:9 or 4:3 the Display Aspect Ratio -dvd_dar=`echo "scale=${BC_SCALE}; 4/3" | bc` -DISPLAY_DAR="4:3" - -while getopts "hwv" flag ;do - case ${flag} in - h) - print_usage - exit 0 - ;; - w) - # Widescreen, 16:9 - dvd_dar=`echo "scale=${BC_SCALE}; 16/9" | bc` - DISPLAY_DAR="16:9" - widescreen=yes - ;; - v) - VERBOSE=yes - ;; - ?) - echo "${PROG_NAME}: Invalid option: ${OPTARG}." - echo "Try \`${PROG_NAME} --help' for more information." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -ne 1 ]; then - print_usage - exit 1 -fi - - -calc_par() -{ - width=$1 - height=$2 - dar=$3 - - echo "scale=${BC_SCALE}; ($height*$dar)/$width" | bc -} - -src_width=$(echo $1 | sed "s!\([0-9]*\)x[0-9]*!\1!") -src_height=$(echo $1 | sed "s![0-9]*x\([0-9]*\)!\1!") - -src_dar=`echo "scale=${BC_SCALE}; $src_width/$src_height" | bc` -src_par=$(calc_par $src_width $src_height $src_dar) - -dvd_par=$(calc_par $dvd_width $dvd_height $dvd_dar) - -# when width of DVD is going to be 720, height will be: -out_height=`echo "scale=0; ($dvd_par*$dvd_width)/$src_dar" | bc` - -# Temporaire: -if [ ${out_height} -gt 480 -a ${out_height} -lt 485 ]; then - out_height=${dvd_height} -fi - -h22=`echo "scale=0; ($out_height/2)*2" | bc` - -# ...and working out height is even, if not add 1 to make it even -if [ $out_height != $h22 ]; then - out_height=`expr $out_height + 1` -fi - -#Padding needed -#And test if even pixels - -p=`echo "scale=0; ($dvd_height-$out_height)/2" | bc` -p22=`echo "scale=0; ($p/2)*2" | bc` - -# Padding values must be even. -if [ $p != $p22 ]; then - p_top=`expr $p - 1` - p_bot=`expr $p + 1` -else - p_bot=$p - p_top=$p -fi - -if [ "x${VERBOSE}" = "xyes" ]; then - out_par=$(calc_par $dvd_width $out_height $dvd_dar) - echo "Source:" - echo " Size................: ${src_width}x${src_height}" - echo " Display Aspect Ratio: ${src_dar}" - echo " Pixel Aspect Ratio..: ${src_par}" - echo - echo "DVD:" - echo " Size................: ${dvd_width}x${dvd_height}" - echo " Display Aspect Ratio: ${dvd_dar}" - echo " Pixel Aspect Ratio..: ${dvd_par}" - echo - echo "Output:" - echo " Size................: ${dvd_width}x${out_height}" - echo " Display Aspect Ratio: ${dvd_dar}" - echo " Pixel Aspect Ratio..: ${out_par}" - echo " Padding Top.........: ${p_top}" - echo " Padding Bottom......: ${p_bot}" - echo - echo "ffmpeg options:" -fi - -echo " -s ${dvd_width}x${out_height} -padtop ${p_top} -padbottom ${p_bot} -aspect ${DISPLAY_DAR}" - -exit $? diff --git a/stage2/hv-utilities/flac2mp3 b/stage2/hv-utilities/flac2mp3 deleted file mode 100755 index 5846f73..0000000 --- a/stage2/hv-utilities/flac2mp3 +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# default = 4 -# 0 = highest quality. -VBR_QUALITY="-V0" -LAME_OPTS="--noreplaygain ${VBR_QUALITY} --add-id3v2 --pad-id3v2 \ - --ignore-tag-errors" -METAFLAC="metaflac" - -print_usage() -{ - echo "$(basename $0) -- Translates FLAC file to MP3." - echo "Usage: $(basename $0) flac-file" -} - -if [ $# = 0 ]; then - print_usage - exit 1 -fi - -a=${1} - -# Checking if input file exist. -if [ ! -f $1 ]; then - echo "$0: File $a not found." - print_usage - exit 1 -fi - -OUTF=`echo "$a" | sed s/\.flac$/.mp3/g` - -ARTIST=`${METAFLAC} "$a" --show-tag=ARTIST | sed s/.*=//g` -TITLE=`${METAFLAC} "$a" --show-tag=TITLE | sed s/.*=//g` -ALBUM=`${METAFLAC} "$a" --show-tag=ALBUM | sed s/.*=//g` -GENRE=`${METAFLAC} "$a" --show-tag=GENRE | sed s/.*=//g` -TRACKNUMBER=`${METAFLAC} "$a" --show-tag=TRACKNUMBER | sed s/.*=//g` -DATE=`${METAFLAC} "$a" --show-tag=DATE | sed s/.*=//g` - -flac -c -d "$a" | lame ${LAME_OPTS} \ - --tt "$TITLE" \ - --tn "${TRACKNUMBER:-0}" \ - --ta "$ARTIST" \ - --tl "$ALBUM" \ - --ty "$DATE" \ - --tg "${GENRE:-12}" \ - - "$OUTF" diff --git a/stage2/hv-utilities/flac2ogg b/stage2/hv-utilities/flac2ogg deleted file mode 100755 index 08495d9..0000000 --- a/stage2/hv-utilities/flac2ogg +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# default = 3. -OGG_QUALITY="4" -OGGENC_OPTS="-q ${OGG_QUALITY}" -METAFLAC="metaflac" - -print_usage() -{ - echo "$(basename $0) -- Translates FLAC file to OGG." - echo "Usage: $(basename $0) flac-file" -} - -if [ $# = 0 ]; then - print_usage - exit 1 -fi - -a=${1} - -# Checking if input file exist. -if [ ! -f $1 ]; then - echo "$0: File $a not found." - print_usage - exit 1 -fi - -OUTF=`echo "$a" | sed s/\.flac$/.ogg/g` - -ARTIST=`${METAFLAC} "$a" --show-tag=ARTIST | sed s/.*=//g` -TITLE=`${METAFLAC} "$a" --show-tag=TITLE | sed s/.*=//g` -ALBUM=`${METAFLAC} "$a" --show-tag=ALBUM | sed s/.*=//g` -GENRE=`${METAFLAC} "$a" --show-tag=GENRE | sed s/.*=//g` -TRACKNUMBER=`${METAFLAC} "$a" --show-tag=TRACKNUMBER | sed s/.*=//g` -DATE=`${METAFLAC} "$a" --show-tag=DATE | sed s/.*=//g` - -flac -c -d "$a" | oggenc ${OGGENC_OPTS} \ - -t "$TITLE" \ - -N "${TRACKNUMBER:-0}" \ - -a "$ARTIST" \ - -l "$ALBUM" \ - -d "$DATE" \ - -G "${GENRE:-12}" \ - -o "$OUTF" - diff --git a/stage2/hv-utilities/gztobz2 b/stage2/hv-utilities/gztobz2 deleted file mode 100755 index 5bb9918..0000000 --- a/stage2/hv-utilities/gztobz2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -print_usage() -{ - echo "$(basename $0) -- Convert multiple compressed gzip files to bzip2." - echo "Usage: $(basename $0) [FILES]" -} - -if [ $# = 0 ]; then - print_usage - exit 1 -fi - -while [ $# -ne 0 ]; do - ORIG_GZIPPED_FILENAME=${1} - - # Checking if input file exist. - if [ ! -f $1 ]; then - echo "$0: File ${ORIG_GZIPPED_FILENAME} not found." - exit 1 - fi - - # Checking if input file is a valid gzipped file. - gzip -t ${ORIG_GZIPPED_FILENAME} - if [ $? -ne 0 ] ; then - echo "$0: File ${ORIG_GZIPPED_FILENAME} is not a valid gzip file." - exit 1 - fi - - # Obtaining uncompressed name of file - FILENAME=$(gunzip -l ${ORIG_GZIPPED_FILENAME} | sed '1d' | sed 's/\(.*\)% \(.*\)/\2/') - - # Decompressing file to standard output and piping result to bzip2 - gunzip ${ORIG_GZIPPED_FILENAME} --stdout | bzip2 --best > ${FILENAME}.bz2 - if [ $? -ne 0 ] ; then - echo "$0: Error converting file ${ORIG_GZIPPED_FILENAME} to bzip2." - exit 1 - fi - - # Keeping the original file's timestamp - touch --reference=${ORIG_GZIPPED_FILENAME} ${FILENAME}.bz2 - - # Deleting original .gz file - if [ -f ${FILENAME}.bz2 ]; then - rm ${ORIG_GZIPPED_FILENAME} - fi - - shift -done diff --git a/stage2/hv-utilities/hv-backup b/stage2/hv-utilities/hv-backup deleted file mode 100755 index 81e2c96..0000000 --- a/stage2/hv-utilities/hv-backup +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -# backup -# -# Creates a single compressed archive. - -if [ ! -f /etc/backup.conf ]; then - echo "Error: missing /etc/backup.conf configuration file." - exit 1 -fi - -# Read list of backup files/directories -source /etc/backup.conf - -# Set default value if not specified -: ${BKP_DEST_DIR:="./"} - -# Default value -ARCHIVE_LABEL="backup-data-amd64-`date '+%Y-%m-%d'`" - -# Exclude files list -EXC_LIST="/tmp/hv-backup-exclude-list" - -print_usage() -{ - echo "$(basename $0) - Backup files/directories." - echo "Usage: $(basename $0) [-h] [--label "label"]" -} - -if [ ${#} -gt 0 ]; then - if [ "x${1}" = "x-h" ]; then - print_usage - exit 0 - fi - if [ "x${1}" = "x--label" ]; then - if [ $# -lt 2 ]; then - echo "Missing arguments for --label option" - print_usage - exit 1 - fi - - ARCHIVE_LABEL=${2} - shift - shift - - if [ $# = 0 ]; then - echo "No directory to backup specified" - print_usage - exit 1 - fi - else - echo "Unknown arguments: ${@}" - print_usage - exit 1 - fi -fi - -ARCHIVE_NAME=${BKP_DEST_DIR}/${ARCHIVE_LABEL}.tar.bz2 - -echo "ARCHIVE_LABEL=$ARCHIVE_LABEL" - -cat > ${EXC_LIST} << "EOF" -/media/* -/proc/* -/dev/* -/sys/* -/tmp/* -*.sock -*.lock -*/.gvfs* -EOF - -# Finding sockets, and listing them in the exclude file. -# Errors and warnings must be discarded because of .gvfs directory for example. -# Even when using -prune option, find exits with a non-zero status when resding -# .gvfs -find ${BKP_FILES_LIST} -type s >> ${EXC_LIST} 2> /dev/null - -# Archiving -tar jcf ${ARCHIVE_NAME} ${BKP_FILES_LIST} \ - --label="${ARCHIVE_LABEL}" \ - --ignore-failed-read \ - --exclude-backups \ - --exclude-caches \ - --exclude-from=${EXC_LIST} \ - --absolute-names \ - --totals - -rm ${EXC_LIST} - -exit $? diff --git a/stage2/hv-utilities/hv-scan b/stage2/hv-utilities/hv-scan deleted file mode 100755 index 6398599..0000000 --- a/stage2/hv-utilities/hv-scan +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# Numérisation d'un document texte, et conversion en PDF - -jpeg_quality=10 -color_mode="Gray" -resolution="200" -extension="pdf" -scan_area="--scan-area Letter" -PROG_NAME=$(basename $0) - -print_usage() -{ - echo "${PROG_NAME} -- Numérisation document 8.5\"x11\" en PDF" - echo "Usage: ${PROG_NAME} [OPTIONS...] FICHIER" - echo - echo "Options:" - echo " -c numérisation en couleur (défaut = noir et blanc)" - echo " -h display this help and exit" - echo " -j format de sortie JPEG (défaut = PDF)" - echo " -q qualité JPEG (défaut = 10)" - echo " 1 = basse qualité" - echo " 100 = haute qualité" - echo " -r résolution (défaut = 200 DPI)" - echo " -p taille photo, 8.5\"x5.5\" (défaut = 8.5\"x11\")" - echo -} - -while getopts "chjpq:r:" flag ;do - case ${flag} in - c) - color_mode="Color" - ;; - j) - extension="jpg" - ;; - h) - print_usage - exit 0 - ;; - p) - scan_area="-l 0 -t 0 -x 215.9 -y 150" - ;; - q) - jpeg_quality=${OPTARG} - ;; - r) - # JPEG resolution - resolution=${OPTARG} - ;; - ?) - echo "${PROG_NAME}: Option invalide: ${OPTARG}." - echo "Essayez \`${PROG_NAME} -h' pour plus d'informations." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -gt 1 ]; then - echo "${PROG_NAME}: Too many arguments." - echo "Essayez \`${PROG_NAME} -h' pour plus d'informations." - exit 1 -fi - -if [ ${#} -ne 1 ]; then - echo "${PROG_NAME}: Nom de fichier manquant." - echo "Essayez \`${PROG_NAME} -h' pour plus d'informations." - exit 1 -fi - -src=${1} - -scanimage --mode ${color_mode} --resolution ${resolution} ${scan_area} | \ - convert - -compress jpeg -quality ${jpeg_quality} ${src}.${extension} diff --git a/stage2/hv-utilities/hv-video-dvd b/stage2/hv-utilities/hv-video-dvd deleted file mode 100755 index b3e5f9f..0000000 --- a/stage2/hv-utilities/hv-video-dvd +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/sh - -#==================================================== -# Options modifiables par l'usager. -#==================================================== - -# Pour convertir une portion seulement, ajouter: "-ss 00:00:00 -t 00:00:30" -START_TIME="00:00:00" -#DURATION="00:01:00" - -# Taille du fichier de sortie selon le video bitrate, -# pour un fichier source AVI de 345M: -# -# Non-spécifié: 811M -# 2000k: 726M -# 1400k: 594M - -# 1 ou 2 -PASSES=1 - -#==================================================== -# Fin des options modifiables par l'usager. -#==================================================== - -print_usage() -{ - echo "Usage: ${PROG_NAME} [OPTION]... FICHIER" - echo "" - echo "Conversion d'un fichier vidéo AVI au format MPEG-2 pour créer un DVD vidéo." - echo "" - echo "Options:" - echo " -a Display Aspect Ratio du DVD, 4:3 (avec barres noires ajoutées) ou 16:9 (widescreen)" - echo " -b video bitrate (ex: -b 1400k)" - echo " -h affiche cette aide et termine" - echo " -o nom du fichier de sortie" - echo " -s taille du fichier source [WxH]" - echo " -w grave le DVD" -} - -#==================================================== -# Options de la ligne de commande -#==================================================== - -while getopts "a:b:ho:s:w" flag ;do - case ${flag} in - a) - # Display Aspect Ratio of DVD, 4:3 (with blank bars added) or 16:9 (widescreen) - dvd_dar=${OPTARG} - ;; - b) - # Video bitrate - video_bitrate=${OPTARG} - ;; - h) - print_usage - exit 0 - ;; - o) - outfile=${OPTARG} - ;; - s) - src_size=${OPTARG} - ;; - w) - bruler="yes" - ;; - ?) - echo "${PROG_NAME}: Option invalide: ${OPTARG}." - echo "Essayez \`${PROG_NAME} -h' pour plus d'informations." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -ne 1 ]; then - echo "Erreur: fichier source non-spécifié." - echo "Essayez \`${PROG_NAME} -h' pour plus d'informations." - exit 1 -fi - -INFILE="${1}" - -if [ -z ${outfile} ]; then - outfile="$(basename ${INFILE} .avi).mpg" -fi - -if [ -z ${DURATION} ]; then - ARG_DURATION="" -else - ARG_DURATION="-t ${DURATION}" -fi - -if [ "x${dvd_dar}" = "x16:9" ]; then - ARG_WIDESCREEN="-w" -else - ARG_WIDESCREEN="" -fi - -if [ -z ${video_bitrate} ]; then - ARG_VIDEO_BIT_RATE="" -else - ARG_VIDEO_BIT_RATE="-b ${video_bitrate}" -fi - -if [ -z ${src_size} ]; then - echo "Erreur: taille du fichier source non-spécifiée." - exit 1 -fi - -#==================================================== -# Obtention des options à utiliser avec FFMPEG -#==================================================== -DVD_CONVERSION_OPTIONS=$(fix-avi ${ARG_WIDESCREEN} ${src_size} ) -# -y : Overwrite output files. -FFMPEG_OPT="-y -ss ${START_TIME} ${ARG_DURATION} -target ntsc-dvd ${ARG_VIDEO_BIT_RATE} ${DVD_CONVERSION_OPTIONS}" - -if [ ! -f ${INFILE} ]; then - echo "Erreur: fichier source absent." - exit 1 -fi - -if [ -f ${outfile} ]; then - echo "Fichier <${outfile}> déjà convertit, terminé." -else - for passe in $(seq ${PASSES}); do - if [ "x${PASSES}" = "x1" ]; then - PASSES_OPT="" - else - PASSES_OPT="-pass $passe" - fi - - echo "FFMPEG options: ${PASSES_OPT} ${FFMPEG_OPT}" - ffmpeg ${PASSES_OPT} -i ${INFILE} ${FFMPEG_OPT} ${outfile} || exit 1 - done -fi - -exit $? diff --git a/stage2/hv-utilities/mail-files b/stage2/hv-utilities/mail-files deleted file mode 100755 index b910580..0000000 --- a/stage2/hv-utilities/mail-files +++ /dev/null @@ -1,307 +0,0 @@ -#!/bin/sh - -# script to email files as attachments. -# ------------------------------------ - -# Additional documentation for this script, including a brief introdcution -# to MIME can be found at: http://home.clara.net/dwotton/unix/mail_files.htm - -# Written: Dave Wotton, July 1998, (Cambridge UK) -# This script comes with no warranty or support. You are -# free to modify it as you wish, but please retain an -# acknowledgement of my original authorship. - -# Amended: Dave Wotton, 6/3/99 -# -t flag now optional. subject also optional -# -# Amended: Dave Wotton, 3/8/00 -# added -b and -u options. By default a file-list which is not -# preceded by a -n, -b, or -u flag is now NOT encoded (the previous -# default was to base64 encode it.). -# -# Amended: Dave Wotton, 10/10/00 -# added a -c (cc:) option. -# Added a tty -s test to prevent the prompt to enter the text body -# being displayed when not connected to a tty. (The text body is -# still required though. /dev/null will suffice.) -# -# Amended: Dave Wotton, 24/2/01 -# Now uses perl to perform the base64 encoding, as it comes as -# standard on most modern Unixes. (You need the perl MIME package -# though, which I believe is standard. ) - -# Amended: Dave Wotton, 22/09/01 -# Now creates a "To:" header and uses the sendmail -t flag to -# duplicate this as the envelope recipients, rather than using the -# user supplied list of addresses simply as envelope recipients. -# This confused some mail clients, specifically Lotus Notes. - -# Amended: Dave Wotton, 30/09/01 -# Now initialises the main variables, so that previously set -# environment variable values (eg. $CC) aren't used instead. -# Enable multiple occurrences of the -t and -c flags. Thanks to -# Jason Judge for these suggestions. - - -# Usage: mail_files [-t] mailid [ -c mailid ] [ -s subject ] [ -f mailid ] -# [-n file_list] [-u file_list] [-b file_list] file_list -# -# -f : The mailid of the sender ( defaults to your userid ) -# Only userids that have been defined as "trusted" in the sendmail -# config file can make use of the -f option. For non-trusted users -# any value specified by this parameter will be ignored by -# sendmail. -# -t : The mailid of the recipient. Mandatory, no default -# multiple mailids can be specified, separated by commas. -# -c : The mailid of any carbon-copy recipients. Optional. -# multiple mailids can be specified, separated by commas. -# -s : The subject string. Optional, default = "Not specified". -# Enclose in quotes. -# -n : no-encode: indicates a list of files which are NOT to be base64 -# or uuencode encoded. Multiple files may be enclosed in double -# quotes. Usual wildcard notation can be used. This option is -# for completeness and can be omitted because the default action -# is not to encode the file-list. -# -b : base64 encoding: indicates a list of files which are to be -# base64 encoded. Multiple files may be enclosed in double quotes. -# Usual wildcard notation can be used. -# -u : uuencode encoding: indicates a list of files which are to be -# uuencode encoded. Multiple files may be enclosed in double -# quotes. Usual wildcard notation can be used. -# file_list : The list of files to send as attachments with no-encoding -# (same as -n option, but the file list does not need to be -# enclosed in quotes if more than one file specified). -# Usual wildcard notation can be used. - -# The program will also prompt for text to be supplied on standard input -# as the main text of the message. - -# eg. -# 1) mail_files Dave.Wotton -b file9.gif t*.htm < /dev/null -# -# email file9.gif as a base64 encoded attachment and the t*.htm -# files unencoded. -# -# 2) mail_files Dave.Wotton -s "my test" -b "file1.gif file2.gif" \ -# < /dev/null -# -# email file1.gif and file2.gif as base64 encoded attachments. - -# The script makes use of perl's MIME package to perform the base-64 -# encoding/decoding. - -# Note that files destined for Windows environments should have a name of -# the form aaaa.bbb where aaaa is up to 8 characters long, and bbb is a -# 3 character sufix. The suffix determines which program is used to -# display/process the data at the remote end. - -# Simple text files can be emailed unencoded. Binary files, or text files -# with long lines ( ie > 1000 chars ) should use the base64 or uuencode -# encoding procedures. Base64 is preferred because it is more universally -# supported. In particular, most PC mail-clients can automatically decode -# base64 encoded attachments. Note that simple text files with short lines -# which are destined for PC environments should not be base64 encoded. -# This is because PCs use a different line-break character to Unix. -# If the text is base64 encoded, the line-breaks are not converted -# automatically and so the data arrives at the remote end without -# line-breaks. - -# set up a 'usage' routine -# ------------------------ - -usage() -{ - [ "$1" ] && ( echo $* ; echo "" ) - - cat <);' < $F - - done -fi - -# Now process the uuencode encrypted attachments ... -# ---------------------------------------------- - -# Sorry, this bit is untested - I haven't got a mail-client which can -# handle uuencoded MIME messages automatically, so can't test if the -# 'Content-Transfer-Encoding: uuencode' line is correct and whether I -# need the uuencode "begin" and "end" lines. - -if [ "$UUE" ] -then - for F in $UUE - do - - BASE=`basename $F` - - echo --DMW.Boundary.605592468 - echo Content-Type: application/octet-stream\; name=\"$BASE\" - echo Content-Disposition: attachment\; filename=\"$BASE\" - echo Content-Transfer-Encoding: uuencode - echo - - uuencode < $F xxx - - done -fi - -# append the final boundary line ... - -echo --DMW.Boundary.605592468-- - -) | /usr/sbin/sendmail -t -r ${FROM} -#> test.txt diff --git a/stage2/hv-utilities/mail-if-fail b/stage2/hv-utilities/mail-if-fail deleted file mode 100755 index 733ff9b..0000000 --- a/stage2/hv-utilities/mail-if-fail +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# This script is used to run a command. If the command failed, -# an email is sent to the address specified by MAILTO. - -# Begin of user modifiable variables -MAILFROM="${USER}" -MAILTO="root" -# End of User modifiable variables - -SENDMAIL="/usr/sbin/sendmail -t -r ${MAILFROM}" -MAILFILE="/tmp/mail-if-fail-output$$" -LOGFILE="/tmp/mail-if-fail-log$$" - -# Running the specified command -${*} 1> ${LOGFILE} 2>&1 - -ERROR_CODE=${?} - -if [ ${ERROR_CODE} -ne "0" ]; then - echo "From: ${MAILFROM}" > ${MAILFILE} - echo "To: ${MAILTO}" >> ${MAILFILE} - echo "Subject: \"${1}\" FAILED (${ERROR_CODE})" >> ${MAILFILE} - echo "Content-type: text/plain" >> ${MAILFILE} - echo "Output of command ${*}:" >> ${MAILFILE} - echo >> ${MAILFILE} - cat ${LOGFILE} >> ${MAILFILE} - cat ${MAILFILE} | ${SENDMAIL} || exit 1 - rm -f ${MAILFILE} -fi - -rm -f ${LOGFILE} - -exit ${ERROR_CODE} diff --git a/stage2/hv-utilities/mail-statistics b/stage2/hv-utilities/mail-statistics deleted file mode 100755 index 565aff8..0000000 --- a/stage2/hv-utilities/mail-statistics +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# Sendmail and Procmail log file analyzer - -# If no parameters are given, use current log file -if [ ${#} = 0 ]; then - SUFFIX="" - SUBDIR="" -elif [ $# -eq 1 ]; then - SUFFIX=".$1" - SUBDIR="backup" -else - echo "Usage: $0 [log file number]" - exit 1 -fi - - -SM_LOG_FILE=/var/log/${SUBDIR}/mail.log${SUFFIX} -PM_LOG_FILE=/var/log/${SUBDIR}/procmail.log${SUFFIX} - - -# Computes a ratio -# arg 1: numerator -# arg 2: denumerator -hv_ratio() -{ - echo $(( ( ( ${1} * 100000 ) / ${2} ) / 1000 )) -} - - -# Sendmail (MTA) statistics -SM_REJECTED=$(cat ${SM_LOG_FILE} | grep 'ruleset=' | wc -l) -SM_ACCEPTED=$(cat ${SM_LOG_FILE} | grep 'stat=Sent' | grep 'mailer=local' | wc -l) -SM_TOTAL=$(( ${SM_REJECTED} + ${SM_ACCEPTED} )) - -# Procmail (MDA) statistics -SPAM_COUNT=$(cat ${PM_LOG_FILE} | grep 'procmail: Match on \"\^X-Spam-Status: Yes' | wc -l) -HAM_COUNT=$(cat ${PM_LOG_FILE} | grep 'procmail: No match on \"\^X-Spam-Status: Yes' | wc -l) -SA_TOTAL=$(( ${SPAM_COUNT} + ${HAM_COUNT} )) - -echo "Sendmail statistics (MTA):" -echo " Accepted: $((${SM_ACCEPTED}))" -echo " Total: ${SM_TOTAL}" -echo " Ratio: $(hv_ratio ${SM_ACCEPTED} ${SM_TOTAL})%" -echo "SpamAssassin statistics:" -echo " Spam: $((${SPAM_COUNT}))" -echo " Total: ${SA_TOTAL}" -echo " Ratio: $(hv_ratio ${SPAM_COUNT} ${SA_TOTAL})%" - -exit 0 diff --git a/stage2/hv-utilities/media-write b/stage2/hv-utilities/media-write deleted file mode 100755 index e66dba6..0000000 --- a/stage2/hv-utilities/media-write +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh - -# Write files/directories on CD or DVD - -# Load configuration informations about device -. /etc/sysconfig/cdrecord - -# Maximum size in Mbytes -CD_MEDIA_SIZE=700 -DVD_MEDIA_SIZE=4400 - -GROWISOFS_OPTS="-dvd-compat" - -# Try to read ATIP infos for CD disks to estimate capacity... -MEDIA_ATIP_INFOS=$(cdrecord dev=${MEDIA_DEV} -atip 2>&1) - -if echo ${MEDIA_ATIP_INFOS} | grep -q "ATIP info from disk"; then - MEDIA_SIZE=${CD_MEDIA_SIZE} - MEDIA_TYPE="CD" - echo "CD disk detected" -elif echo ${MEDIA_ATIP_INFOS} | grep -q "Found DVD media but"; then - MEDIA_SIZE=${DVD_MEDIA_SIZE} - MEDIA_TYPE="DVD" - echo "DVD disk detected" -elif echo ${MEDIA_ATIP_INFOS} | grep -q "cdrecord: No disk / Wrong disk"; then - echo "No disk inserted, aborting" - exit 1 -else - echo "Unable to determine disk capacity, aborting" - exit 1 -fi - -echo "Disk capacity is ${MEDIA_SIZE} Mbytes" - -BKP_TMP_DIR=${BKP_TMP_DIR:-"/tmp"} -TMP_FILE="${BKP_TMP_DIR}/media-write-file$$" -TMP_MOUNT="${BKP_TMP_DIR}/media-write-mount$$" - -print_usage() -{ - echo "Usage: $(basename $0) files..." -} - -evaluate_retval() -{ - last_error=$? - if [ ${last_error} -ne 0 ]; then - exit ${last_error} - fi -} - -if [ $# = 0 ]; then - print_usage - exit 1 -fi - -FILES_SIZE="0" - -FILES_WRITE_LIST=${*} - -for file in ${FILES_WRITE_LIST}; do - if [ -d ${file} -o -f ${file} ]; then - FILES_SIZE=$(expr ${FILES_SIZE} + `du -m ${file} -s | sed 's/\([0-9]*\).*/\1/g'`) - else - echo "$0: Directory or file ${file} not found." - print_usage - exit 1 - fi -done - -echo "Total size of files to backup is ${FILES_SIZE}Mbytes" - -# The ext2 filesystem is not as space-efficient as the reiser filesystem, -# so we must add a few megabytes... -FILES_SIZE=`expr $FILES_SIZE + 20` - -if [ ${FILES_SIZE} -gt ${MEDIA_SIZE} ]; then - echo "Total size is greater than media capacity, aborting" - exit 1 - #####FILES_SIZE=${MEDIA_SIZE} -fi - -# Create an empty file of $FILES_SIZE -dd if=/dev/zero of=${TMP_FILE} bs=1024k count=${FILES_SIZE} -if [ $? -ne 0 ]; then - echo "Error while creating empty file..." - rm -f ${TMP_FILE} - exit 1 -fi - -# Create an extended-2 filesystem on this file -echo y | /sbin/mke2fs -m 0 -b 2048 ${TMP_FILE} -if [ $? -ne 0 ]; then - echo "Error creating file system on empty file..." - rm -f ${TMP_FILE} - exit 1 -fi - -# Mount this empty file through the loopback device. -mkdir -p ${TMP_MOUNT} -mount -o loop -t ext2 ${TMP_FILE} ${TMP_MOUNT} -if [ $? -ne 0 ]; then - echo "Error mounting empty file..." - rm -f ${TMP_FILE} - rm -rf $TMP_MOUNT - exit 1 -fi - -# Removing lost+found directory -rmdir ${TMP_MOUNT}/lost+found - -# Copy files to $TMP_MOUNT and umount it afterwards. -echo "Copying files..." -cp -a --parents ${FILES_WRITE_LIST} ${TMP_MOUNT} -if [ $? -ne 0 ]; then - echo "Error while copying files..." - umount ${TMP_MOUNT} - rm -rf ${TMP_MOUNT} - rm -f ${TMP_FILE} - exit 1 -fi - -umount ${TMP_MOUNT} - -echo Press any key to burn files -read - -#*************************************************** -# Burning... -#*************************************************** -case "${MEDIA_TYPE}" in - CD) - cdrecord ${CDRECORD_OPTS} dev=${MEDIA_DEV} -data ${TMP_FILE} || exit 1 - ;; - DVD) - growisofs ${GROWISOFS_OPTS} -Z /dev/dvd=${TMP_FILE} || exit 1 - ;; - *) - echo "Unknown removable media type, aborting" - exit 1 - ;; -esac - -# Mounting the media to verify burned capacity -if ! grep -q ${MEDIA_DEV} /etc/mtab; then - mount ${MEDIA_DEV} ${MEDIA_DIR} || exit 1 -fi - -FILES_SIZE=$(du -m ${MEDIA_DIR} -s | sed 's/\([0-9]*\).*/\1/g') -echo "Total size of files backed-up is ${FILES_SIZE}Mbytes" - -umount ${MEDIA_DIR} - -rmdir ${TMP_MOUNT} -rm -f ${TMP_FILE} - -exit $? diff --git a/stage2/hv-utilities/pstopdf b/stage2/hv-utilities/pstopdf deleted file mode 100755 index 36e3b1c..0000000 --- a/stage2/hv-utilities/pstopdf +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -print_usage() -{ - echo "pstopdf -- Translates multiple Postscript files into a" - echo " unique PDF document." - echo "Usage: $(basename $0) [OPTION]... [FILE]..." - echo - echo " -o filename Specify the name of the generated PDF file. The" - echo " default is 'output.pdf'." -} - -while getopts ":o:" opt; do - case $opt in - o ) - PDF_FILE=$OPTARG - ;; - \? ) - print_usage - ;; - esac -done - -if [ -z "${PDF_FILE}" ]; then - PDF_FILE="output.pdf" -fi - -shift $(($OPTIND - 1)) - -if [ $# -eq 0 ]; then - print_usage - exit 1 -fi - -gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=${PDF_FILE} $@ - -exit 0 diff --git a/stage2/hv-utilities/replace.pl b/stage2/hv-utilities/replace.pl deleted file mode 100755 index 8347be6..0000000 --- a/stage2/hv-utilities/replace.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl -w -# -# Usage: replace.pl original_string replacement_string input_filename -# This Perl script changes the string $original to $replacement in all files -# specified on the command line. -# 19950926 gkj -$original=$ARGV[0]; -$replacement=$ARGV[1]; -# The input record separator is defined by Perl global -# variable $/. It can be anything, including multiple -# characters. Normally it is "\n", newline. Here, we -# say there is no record separator, so the whole file -# is read as one long record, newlines included. -undef $/; - -$file=$ARGV[2]; - -if (! open(INPUT,"<$file") ) { - print STDERR "Can't open input file $bakfile\n"; - exit(0); -} - -# Read input file as one long record. -$data=; -close INPUT; - -if ($data =~ s/$original/$replacement/gi) { - $bakfile = "$file.bak"; - # Abort if can't backup original or output. - if (! rename($file,$bakfile)) { - die "Can't rename $file $!"; - } - if (! open(OUTPUT,">$file") ) { - die "Can't open output file $file\n"; - } - print OUTPUT $data; - close OUTPUT; - print STDERR "$file changed\n"; -} -else { - print STDERR "$file not changed\n"; -} - -exit(0); diff --git a/stage2/hv-utilities/rotatelogs b/stage2/hv-utilities/rotatelogs deleted file mode 100755 index dd5cc41..0000000 --- a/stage2/hv-utilities/rotatelogs +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -# -# rotatelogs - rotate log files (local host) -# - -BACKUP_LOGDIR="/var/log/backup" - -LOGDIR_GLOBAL=/var/log -LOGFILES_GLOBAL="auth.log clamd.log freshclam.log cron.log daemon.log kern.log mail.log procmail.log scrollkeeper.log sys.log user.log xdm.log Xorg.0.log" - -LOGDIR_APACHE=/var/log/apache -LOGFILES_APACHE="access_log error_log ssl_request_log" - -LOGDIR_CUPS=/var/log/cups -LOGFILES_CUPS="access_log error_log" - -LOGDIR_NAMED=/srv/named/etc/namedb -LOGFILES_NAMED="named.run" - -# arg 1: Backup log directory -# arg 2: log filename -rotate_log() -{ - backup_log_dir=${1} - file=${2} - - for day in 8 7 6 5 4 3 2 1 0 ; do - if [ -f ${backup_log_dir}/${file}.${day} ]; then - mv ${backup_log_dir}/${file}.${day} ${backup_log_dir}/${file}.$((${day}+1)) || exit 1 - fi - done - - if [ -f ${file} ]; then - user=$(ls -l --numeric-uid-gid ${file} | awk '{ print $3 }') - group=$(ls -l --numeric-uid-gid ${file} | awk '{ print $4 }') - cp -a ${file} ${backup_log_dir}/${file}.0 || exit 1 - fi - - # Empty file - cp /dev/null ${file} && - chown ${user}.${group} ${file} && - chmod 640 ${file} - - return $? -} - -if [ ! -d ${BACKUP_LOGDIR} ]; then - mkdir ${BACKUP_LOGDIR} -fi - -# syslogd files -LOGDIR=${LOGDIR_GLOBAL} -cd ${LOGDIR} && -for file in ${LOGFILES_GLOBAL}; do - rotate_log ${BACKUP_LOGDIR} ${file} || exit 1 -done - -kill -HUP `cat /var/run/syslogd.pid` && - -# named (BIND) server log files (if installed) -LOGDIR=${LOGDIR_NAMED} -if [ -d ${LOGDIR} ]; then - cd ${LOGDIR} && - for file in ${LOGFILES_NAMED}; do - rotate_log ${BACKUP_LOGDIR} ${file} || exit 1 - done - - kill -HUP `cat /srv/named/var/run/named.pid` || exit 1 -fi - -# For Apache web server (if installed) -LOGDIR=${LOGDIR_APACHE} -if [ -d ${LOGDIR} ]; then - if [ ! -d ${BACKUP_LOGDIR}/apache ]; then - mkdir -p ${BACKUP_LOGDIR}/apache - fi - cd ${LOGDIR} && - for file in ${LOGFILES_APACHE}; do - rotate_log ${BACKUP_LOGDIR}/apache ${file} || exit 1 - done - - /usr/sbin/apachectl graceful && - sleep 2 -fi - -# For CUPS -LOGDIR=${LOGDIR_CUPS} -if [ -d ${LOGDIR} ]; then - if [ ! -d ${BACKUP_LOGDIR}/cups ]; then - mkdir -p ${BACKUP_LOGDIR}/cups - fi - cd ${LOGDIR} && - for file in ${LOGFILES_CUPS}; do - rotate_log ${BACKUP_LOGDIR}/cups ${file} || exit 1 - done -fi - -exit $? diff --git a/stage2/hv-utilities/setdate b/stage2/hv-utilities/setdate deleted file mode 100755 index ce2f14e..0000000 --- a/stage2/hv-utilities/setdate +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -rm /var/lib/hwclock/adjtime -hwclock --localtime --set --date "2004/03/02 23:56:00" -hwclock --localtime --hctosys -date diff --git a/stage2/hv-utilities/strip-debug-symbols b/stage2/hv-utilities/strip-debug-symbols deleted file mode 100755 index 6adf92a..0000000 --- a/stage2/hv-utilities/strip-debug-symbols +++ /dev/null @@ -1,2 +0,0 @@ -find /{,usr/,usr/local/}{bin,sbin,lib} -type f -exec /usr/bin/strip --strip-debug '{}' ';' - diff --git a/stage2/hv-utilities/tape-backup/tape-backup b/stage2/hv-utilities/tape-backup/tape-backup deleted file mode 100755 index 1782eaf..0000000 --- a/stage2/hv-utilities/tape-backup/tape-backup +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -# tape-backup -# -# Creates a single archive on tape. After the backup is finished, -# the tape is rewound. - -# Read configuration informations -source /etc/backup.conf - -# Exclude files list -EXC_LIST="/tmp/exclude-sockets" - -print_usage() -{ - echo "$(basename $0) - Backup directories/files, starting at the beginning of the tape." - echo " After the backup is finished, the tape is rewound." - echo "Usage: $(basename $0) [-h] [--label "label"] DIR1 DIR2 ..." -} - -if [ ${#} -gt 0 ]; then - if [ "x${1}" = "x-h" ]; then - print_usage - exit 0 - fi -fi - -if [ $# = 0 ]; then - echo "Missing arguments" - print_usage - exit 1 -fi - -if [ "x${1}" = "x--label" ]; then - if [ $# -lt 2 ]; then - echo "Missing arguments for --label option" - print_usage - exit 1 - fi - - TAPE_LABEL=${2} - shift - shift - - if [ $# = 0 ]; then - echo "No directory to backup specified" - print_usage - exit 1 - fi - -else - TAPE_LABEL="CVDS Linux Mail/Web Server Backup (`date '+%Y-%m-%d'`)." -fi - -DIRECTORIES=${@} - -echo "TAPE_LABEL=$TAPE_LABEL" - -if ${MT} status | grep "ONLINE"; then - # Rewinding the tape - ${MT} rewind || exit 1 - - # Finding sockets - find ${DIRECTORIES} -type s > ${EXC_LIST} || exit 1 - - # Setting compression on - ${MT} compression 1 || exit 1 - - # Archiving - tar -cf /dev/tape ${DIRECTORIES} --ignore-failed-read --label="${TAPE_LABEL}" \ - --exclude="*.sock" --exclude="*.lock" --exclude-from=${EXC_LIST} \ - --absolute-names --totals || exit 1 - - if ! ${MT} status | grep "ONLINE"; then - echo "***** tape-drive status is not ONLINE" - exit 1 - fi - - # Rewinding the tape - ${MT} rewind || exit 1 - - # Ejecting tape - ${MT} offline || exit 1 - - rm ${EXC_LIST} -else - echo "***** WARNING TAPE DRIVE IS OFFLINE, NO BACKUPS PERFORMED" - exit 1 -fi - -exit $? diff --git a/stage2/hv-utilities/tape-backup/tape-backup-mult b/stage2/hv-utilities/tape-backup/tape-backup-mult deleted file mode 100755 index e07269f..0000000 --- a/stage2/hv-utilities/tape-backup/tape-backup-mult +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -# tape-backup-mult -# -# Creates archive at current position of tape, thus enabling creation of -# multiple archives on a single tape. After the backup is finished, -# the tape is NOT rewound. - -# Read configuration informations -source /etc/backup.conf - -# Exclude files list -EXC_LIST="/tmp/exclude-sockets" - -print_usage() -{ - echo "$(basename $0) - Backup directories/files, starting at the current position of the tape." - echo " After the backup is finished, the tape is NOT rewound." - echo "Usage: $(basename $0) [-h] [--label "label"] DIR1 DIR2 ..." -} - -if [ ${#} -gt 0 ]; then - if [ "x${1}" = "x-h" ]; then - print_usage - exit 0 - fi -fi - -if [ $# = 0 ]; then - echo "Missing arguments" - print_usage - exit 1 -fi - -if [ "x${1}" = "x--label" ]; then - if [ $# -lt 2 ]; then - echo "Missing arguments for --label option" - print_usage - exit 1 - fi - - TAPE_LABEL=${2} - shift - shift - - if [ $# = 0 ]; then - echo "No directory to backup specified" - print_usage - exit 1 - fi - -else - TAPE_LABEL="Backup (`date '+%Y-%m-%d'`)" -fi - -DIRECTORIES=${@} - -echo "TAPE_LABEL=$TAPE_LABEL" - -if ${MT} status | grep "ONLINE"; then - - # We don't rewind the tape, we add a new archive at the current position of the tape. - - # Finding sockets - # Removed, because the find command returned: "find: /root/big-file.tar.bz2: Value too large for defined data type" - # (the file was 6G) - # find ${DIRECTORIES} -type s > ${EXC_LIST} || exit 1 - echo "" > ${EXC_LIST} - - # Setting compression on - ${MT} compression 1 || exit 1 - - # Archiving - tar -cf /dev/tape ${DIRECTORIES} --label="${TAPE_LABEL}" --exclude-from=${EXC_LIST} --absolute-names --totals || exit 1 - - if ! ${MT} status | grep "ONLINE"; then - echo "***** tape-drive status is not ONLINE" - exit 1 - fi - - rm ${EXC_LIST} -else - echo "***** WARNING TAPE DRIVE IS OFFLINE, NO BACKUPS PERFORMED" - exit 1 -fi - -exit $? diff --git a/stage2/hv-utilities/tape-backup/tape-list b/stage2/hv-utilities/tape-backup/tape-list deleted file mode 100755 index d689cf6..0000000 --- a/stage2/hv-utilities/tape-backup/tape-list +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh - -# tape-list - -# Read configuration informations -source /etc/backup.conf - -print_usage() -{ - echo "$(basename $0) - List content of tape archive." - echo "Usage: $(basename $0) [-h] [--label]" -} - -if [ ${#} -gt 0 ]; then - if [ "x${1}" = "x-h" ]; then - print_usage - exit 0 - fi -fi - -if [ $# -gt 1 ]; then - print_usage - exit 1 -fi - -if [ $# = 1 ]; then - if [ "x${1}" != "x--label" ]; then - echo "Invalid argument" - print_usage - exit 1 - fi - - print_label="1" -fi - -if ${MT} status | grep "ONLINE" 1> /dev/null 2>&1; then - - # Rewinding the tape - ${MT} rewind || exit 1 - - file="0" - quit="0" - - while [ ${quit} = "0" ]; do - - file="$(( ${file} + 1 ))" - - if [ "x${print_label}" = "x1" ]; then - echo "Label for archive #$file:" - tar tvf /dev/tape | grep "V---------" - if [ $? -ne 0 ]; then - echo "No archive #$file:" - quit="1" - fi - else - echo "Content of archive #$file:" - tar tvf /dev/tape || exit 1 - fi - - if [ ${quit} = "0" ]; then - # Position tape on next file - ${MT} fsf 1 - if [ $? -ne 0 ]; then - quit="1" - fi - fi - - done - -else - echo "TAPE DRIVE IS OFFLINE, NO LISTING PERFORMED" - exit 1 -fi - -exit $? diff --git a/stage2/hv-utilities/tape-backup/tape-restore b/stage2/hv-utilities/tape-backup/tape-restore deleted file mode 100755 index 5c101af..0000000 --- a/stage2/hv-utilities/tape-backup/tape-restore +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# tape-restore - -# Read configuration informations -source /etc/backup.conf - -print_usage() -{ - echo "$(basename $0) - Restore file or directory from tape." - echo "Usage: $(basename $0) [-h] FILE" -} - -if [ ${#} -gt 0 ]; then - if [ "x${1}" = "x-h" ]; then - print_usage - exit 0 - fi -fi - -if [ $# != 1 ]; then - print_usage - exit 1 -fi - -if ${MT} status | grep "ONLINE"; then - # Rewinding the tape - ${MT} rewind || exit 1 - - # The tape is now positioned on the first archive - tar xvf /dev/tape ${@} || exit 1 -else - echo "TAPE DRIVE IS OFFLINE, NO RESTORE PERFORMED" -fi - -exit $? diff --git a/stage2/hv-utilities/tarbz2 b/stage2/hv-utilities/tarbz2 deleted file mode 100755 index e7a6d93..0000000 --- a/stage2/hv-utilities/tarbz2 +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -print_usage() -{ - echo "$(basename $0) -- Create bzip2 compressed TAR archive." - echo "Usage: $(basename $0) DIR" -} - -if [ $# -ne 1 ]; then - print_usage - exit 1 -fi - -DIR=${1%/} -BASE=$(basename ${DIR}) - -# Checking if directory exists. -if [ ! -d ${DIR} ]; then - echo "$0: Directory ${DIR} not found." - exit 1 -fi - -# Decompressing file to standard output and piping result to bzip2 -tar cvf - ${DIR} | bzip2 -9 > ${BASE}.tar.bz2 - -exit $? diff --git a/stage2/hv-utilities/tildes-clean b/stage2/hv-utilities/tildes-clean deleted file mode 100755 index 8c7dfaa..0000000 --- a/stage2/hv-utilities/tildes-clean +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -# No arguments --> clean the current directory - -PROG_NAME=$(basename $0) -MAXDEPTH="-maxdepth 1" - -print_usage() -{ - echo "Usage: ${PROG_NAME} [OPTION]... [SOURCE]" - echo - echo "Remove emacs backup files (ending with \`~') in SOURCE directory." - echo "If no SOURCE directory is specified, the current directory is" - echo "taken as SOURCE. Directory names ending with \`~' are not" - echo "removed, only files." - echo - echo "Options:" - echo " -h display this help and exit" - echo " -r allow cleanning of subdirectories" - exit 0 -} - -while getopts "hr" flag ;do - case ${flag} in - h) - print_usage - ;; - r) - MAXDEPTH="" - ;; - ?) - echo "${PROG_NAME}: Invalid option: ${OPTARG}." - echo "Try \`${PROG_NAME} --help' for more information." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -gt 1 ]; then - echo "${PROG_NAME}: Too many arguments." - echo "Try \`${PROG_NAME} --help' for more information." - exit 1 -fi - -if [ $# = 0 ]; then - source_dir="." -else - source_dir="${1}" -fi - -if [ ! -d ${source_dir} ]; then - echo "${PROG_NAME}: ${source_dir}: No such directory." - exit 1 -fi - -# We remove the trailing `/' at the end of directory, if present. -source_dir=$(echo ${source_dir} | sed 's/\/$//g') - -find ${source_dir} ${MAXDEPTH} -name '*~' -exec /bin/rm '{}' + - -exit $? diff --git a/stage2/hv-utilities/vd b/stage2/hv-utilities/vd deleted file mode 100755 index 9eb09a5..0000000 --- a/stage2/hv-utilities/vd +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -VCS_SUPPORTED="GIT, Subversion or Mercurial" - -print_usage() -{ - echo "$(basename $0) -- diff for version control (${VCS_SUPPORTED}) with color output." - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if git diff 1> /dev/null 2>&1; then - git diff "$@" -elif svn diff 1> /dev/null 2>&1; then - svn diff --diff-cmd colordiff -x "-u -w -p" "$@" | less -RFX -elif hg status 1> /dev/null 2>&1; then - hg diff "$@" -else - echo "Not a ${VCS_SUPPORTED} repository" - exit 1 -fi diff --git a/stage2/hv-utilities/vl b/stage2/hv-utilities/vl deleted file mode 100755 index a19a374..0000000 --- a/stage2/hv-utilities/vl +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -VCS_SUPPORTED="GIT, Subversion or Mercurial" - -print_usage() -{ - echo "$(basename $0) -- log for version control (${VCS_SUPPORTED})." - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -SVN_LOG_REV_INFO_COLOR=$(echo -e '\033[1;31m') # Red -SVN_LOG_SEPARATION_COLOR=$(echo -e '\033[1;32m') # Green -NORMAL=$(echo -e '\033[0m') - -if git diff 1> /dev/null 2>&1; then - git log "$@" -elif svn diff 1> /dev/null 2>&1; then - # Colore les lignes --------- en vert - # Colore en rouge les infos de la révision - svn log "$@" | sed -e "s/^-\+$/${SVN_LOG_SEPARATION_COLOR}\0${NORMAL}/" \ - -e "s/^r[0-9]\+.\+$/${SVN_LOG_REV_INFO_COLOR}\0${NORMAL}/" | less -RFX -elif hg status 1> /dev/null 2>&1; then - hg glog "$@" -else - echo "Not a ${VCS_SUPPORTED} repository" - exit 1 -fi diff --git a/stage2/hv-utilities/vs b/stage2/hv-utilities/vs deleted file mode 100755 index 6719db1..0000000 --- a/stage2/hv-utilities/vs +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -VCS_SUPPORTED="GIT, Subversion or Mercurial" - -print_usage() -{ - echo "$(basename $0) -- status for version control (${VCS_SUPPORTED})." - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -SVN_ST_UNKNOWN_COLOR=$(echo -e '\033[1;34m') # Blue -SVN_ST_DELETED_COLOR=$(echo -e '\033[0;31m') # Red -SVN_ST_MISSING_COLOR=$(echo -e '\033[1;31m') # Red -SVN_ST_ADDED_COLOR=$(echo -e '\033[1;32m') # Green -SVN_ST_MODIFIED_COLOR=$(echo -e '\033[1;33m') # Yellow -NORMAL=$(echo -e '\033[0m') - -if git diff 1> /dev/null 2>&1; then - git status "$@" -elif svn diff 1> /dev/null 2>&1; then - svn status --ignore-externals "$@" | grep -v "^X" | \ - sed -e "s/^\?.*$/${SVN_ST_UNKNOWN_COLOR}\0${NORMAL}/" \ - -e "s/^!.*$/${SVN_ST_MISSING_COLOR}\0${NORMAL}/" \ - -e "s/^A.*$/${SVN_ST_ADDED_COLOR}\0${NORMAL}/" \ - -e "s/^M.*$/${SVN_ST_MODIFIED_COLOR}\0${NORMAL}/" \ - -e "s/^D.*$/${SVN_ST_DELETED_COLOR}\0${NORMAL}/" -elif hg status 1> /dev/null 2>&1; then - hg status "$@" -else - echo "Not a ${VCS_SUPPORTED} repository" - exit 1 -fi diff --git a/stage2/install-hv-utilities b/stage2/install-hv-utilities deleted file mode 100755 index e297ca9..0000000 --- a/stage2/install-hv-utilities +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -source ../functions/main - -SRCDIR="./hv-utilities" -PREFIX="/usr/local" -BINDIR="${PREFIX}/bin" -SYSBINDIR="${PREFIX}/sbin" -SYSCONFDIR="/etc" -BIN_UTILITIES="camera-download cd-erase cd-copy cgrep pstopdf distro-backup \ - dos2unix fix-avi gztobz2 hv-backup hv-video-dvd \ - mail-files mail-if-fail mail-statistics media-write pstopdf \ - replace.pl rotatelogs setdate strip-debug-symbols tarbz2 \ - tildes-clean vd vs vl flac2ogg flac2mp3 hv-scan" - -for program in ${BIN_UTILITIES}; do - install -v ${SRCDIR}/${program} ${BINDIR} -done - -install -v -m 644 ${SRCDIR}/backup.conf ${SYSCONFDIR} - -# Install fcrontab for rotatelogs -echo "# Rotate logs every day at 00:05" > /etc/fcron/fcron.d/rotatelogs -echo "&mail(false) 05 00 * * * ${BINDIR}/rotatelogs" >> /etc/fcron/fcron.d/rotatelogs - -exit $? diff --git a/stage2/packages-update b/stage2/packages-update index 9ad7f44..3b3d591 100755 --- a/stage2/packages-update +++ b/stage2/packages-update @@ -92,5 +92,6 @@ fpkg -m gnu ${GRUB} fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/$(get_pkg_ver ${DHCP})" fpkg -e "tar.gz" ${ACPID} "http://www.tedfelix.com/linux" +fpkg -m hv ${HV_UTILITIES} exit $? diff --git a/stage2/pkg/hv-utilities b/stage2/pkg/hv-utilities new file mode 100644 index 0000000..d0e3c5f --- /dev/null +++ b/stage2/pkg/hv-utilities @@ -0,0 +1,8 @@ +#!/bin/bash + +hvbuild_post() +{ + # Install fcrontab for rotatelogs + echo "# Rotate logs every day at 00:05" > /etc/fcron/fcron.d/rotatelogs + echo "&mail(false) 05 00 * * * /usr/local/bin/rotatelogs" >> /etc/fcron/fcron.d/rotatelogs +} -- 2.20.1