From 4108a92c90fdef07f556ac73476fba6441822992 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 15 Aug 2010 01:05:58 -0400 Subject: [PATCH] more bin/profiles --- .bin/backup-dvd | 73 ++++++++++++++++++++++++++++++++++++++ .bin/upload-gentoo-package | 29 +++++++++++++++ .profile.d/gnu.sh | 7 ++++ 3 files changed, 109 insertions(+) create mode 100755 .bin/backup-dvd create mode 100755 .bin/upload-gentoo-package create mode 100644 .profile.d/gnu.sh diff --git a/.bin/backup-dvd b/.bin/backup-dvd new file mode 100755 index 0000000..26f35a1 --- /dev/null +++ b/.bin/backup-dvd @@ -0,0 +1,73 @@ +#!/bin/bash + +usage() { + cat <<-EOF + backup-dvd [options] + + Options: + -i Defaults to ${dev} + -o Defaults to ${out} + EOF + exit ${1:-0} +} + +dev=/dev/cdrom +out=${PWD} + +eval set -- `getopt -- hi:o: "$@"` +while [[ -n $1 ]] ; do + case $1 in + -h) usage;; + -i) dev=$2; shift 2;; + -o) out=$2; shift 2;; + --) shift; break;; + -*) usage 1;; + *) usage 2; break;; + esac +done + +# iso-info mkisofs +Application= # -A +Preparer= # -p +Publisher= # -publisher +System= # -sysid +Volume= # -V +Volume_Set= # -volset + +info=$(iso-info ${dev}) || exit 1 + +eval $(echo "${info}" | awk -F: ' + (NF > 1 && $1 !~ /image/) { + sub(/ *$/, "", $1); + sub(/ /, "_", $1); + sub(/^ */, "", $2); + print $1 "=\"" $2 "\""; +}') + +if [[ -z ${Volume} ]] ; then + echo "Unable to parse Volume out of ISO" + iso-info ${dev} +fi + +echo "Backing up: ${Volume}" + +e() { + for a ; do + [[ ${a} == *" "* || ${#a} == 0 ]] && fmt='"%s"' || fmt='%s' + printf "${fmt} " "${a}" + done + echo + "$@" +} +e dvdbackup -M -i ${dev} -o "${out}" +e mkisofs -quiet -dvd-video \ + -A "${Application}" \ + -p "${Preparer}" \ + -publisher "${Publisher}" \ + -sysid "${System}" \ + -V "${Volume}" \ + -volset "${Volume_Set}" \ + -o "${out}/${Volume}.iso" "${Volume}" +du -h "${out}/${Volume}.iso" + +exec eject diff --git a/.bin/upload-gentoo-package b/.bin/upload-gentoo-package new file mode 100755 index 0000000..503afae --- /dev/null +++ b/.bin/upload-gentoo-package @@ -0,0 +1,29 @@ +#!/bin/bash + +err() { echo "$*" 1>&2; exit 1; } + +if [[ $# -eq 0 ]] ; then + cat <<-EOF + Usage: $0 + EOF + exit 1 +fi + +for pkg in "$@" ; do + if [[ ! -e ${pkg} ]] ; then + case ${pkg} in + */*) err "${pkg}: does not exist" ;; + *) + pkg="/usr/portage/distfiles/${pkg}" + if [[ ! -e ${pkg} ]] ; then + err "${pkg}: does not exist" + fi + ;; + esac + fi + + p=${pkg##*/} + echo "${p}: posting" + scp "${pkg}" dev:~/ + ssh dev "cp ${p} public_html/dist/ && mv ${p} /space/distfiles-local/" +done diff --git a/.profile.d/gnu.sh b/.profile.d/gnu.sh new file mode 100644 index 0000000..62a52ef --- /dev/null +++ b/.profile.d/gnu.sh @@ -0,0 +1,7 @@ +GNULIB_SRCDIR=/usr/local/src/gnu/gnulib +[[ ! -d ${GNULIB_SRCDIR} ]] && GNULIB_SRCDIR=/usr/local/src/gnulib +if [[ -d ${GNULIB_SRCDIR} ]] ; then + export GNULIB_SRCDIR +else + unset GNULIB_SRCDIR +fi -- 2.39.2