]> git.wh0rd.org Git - home.git/commitdiff
more bin/profiles
authorMike Frysinger <vapier@gentoo.org>
Sun, 15 Aug 2010 05:05:58 +0000 (01:05 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:36 +0000 (15:36 -0400)
.bin/backup-dvd [new file with mode: 0755]
.bin/upload-gentoo-package [new file with mode: 0755]
.profile.d/gnu.sh [new file with mode: 0644]

diff --git a/.bin/backup-dvd b/.bin/backup-dvd
new file mode 100755 (executable)
index 0000000..26f35a1
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+usage() {
+       cat <<-EOF
+       backup-dvd [options]
+
+       Options:
+        -i <input dev>      Defaults to ${dev}
+        -o <output dir>     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 (executable)
index 0000000..503afae
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+err() { echo "$*" 1>&2; exit 1; }
+
+if [[ $# -eq 0 ]] ; then
+       cat <<-EOF
+       Usage: $0 <files to post>
+       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 (file)
index 0000000..62a52ef
--- /dev/null
@@ -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