[Debian-live-changes] r1119 - in
configs/daniel/config/chroot_localincludes/usr/local: . bin
Daniel Baumann
daniel at alioth.debian.org
Sun Apr 22 08:13:56 UTC 2007
Author: daniel
Date: 2007-04-22 08:13:56 +0000 (Sun, 22 Apr 2007)
New Revision: 1119
Added:
configs/daniel/config/chroot_localincludes/usr/local/bin/
configs/daniel/config/chroot_localincludes/usr/local/bin/chmods
configs/daniel/config/chroot_localincludes/usr/local/bin/chowns
configs/daniel/config/chroot_localincludes/usr/local/bin/cpufreqs
configs/daniel/config/chroot_localincludes/usr/local/bin/halt
configs/daniel/config/chroot_localincludes/usr/local/bin/md5sums
configs/daniel/config/chroot_localincludes/usr/local/bin/pss
configs/daniel/config/chroot_localincludes/usr/local/bin/reboot
configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-disk
configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-mem
configs/daniel/config/chroot_localincludes/usr/local/bin/vi-mtime
configs/daniel/config/chroot_localincludes/usr/local/bin/vis
Log:
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/chmods
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/chmods 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/chmods 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# chmods.sh - Setting default file access permissions
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+EXCLUDES="*.changes"
+EXECUTABLES="*.sh"
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ]
+then
+ echo "chmods.sh - Setting default file access permissions"
+ echo
+ echo "Usage: `basename ${0}` [DIRECTORY]"
+ exit 1
+fi
+
+# Setting path
+if [ ! -z "${1}" ]
+then
+ DIRECTORY="${1}"
+else
+ DIRECTORY="`pwd`"
+fi
+
+# Process directories
+find "${DIRECTORY}" -type d | xargs chmod 0755
+find "${DIRECTORY}" -type d -name lost+found | xargs chmod 0700
+
+# Process files
+find "${DIRECTORY}" -type f | xargs chmod 0644
+
+# Process excludes
+for EXCLUDES in ${EXCLUDES}
+do
+ find "${DIRECTORY}" -type f -name "${EXCLUDES}" | xargs chmod 0640
+done
+
+# Process executables
+for EXECUTABLE in ${EXECUTABLES}
+do
+ find "${DIRECTORY}" -type f -name "${EXECUTABLE}" | xargs chmod 0755
+done
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/chmods
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/chowns
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/chowns 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/chowns 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# chowns.sh - Setting default file owner and group
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+USER="root"
+GROUP="${USER}"
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ]
+then
+ echo "chowns.sh - Setting default file owner and group"
+ echo
+ echo "Usage: `basename ${0}` [USER]"
+ exit 1
+fi
+
+# Process data
+if [ ! -z "${1}" ]
+then
+ chown "${1}":"${1}" "`pwd`" -R
+else
+ chown "${USER}":"${GROUP}" "`pwd`" -R
+fi
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/chowns
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/cpufreqs
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/cpufreqs 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/cpufreqs 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,194 @@
+#!/bin/sh
+
+# cpufreqs.sh - Setting cpu frequencies
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ]
+then
+ echo "cpufreqs.sh - Setting cpu frequencies"
+ echo
+ echo "Usage: `basename ${0}` {gov|per|use|ava|cur|man|max|min}"
+ echo "Usage: `basename ${0}` {governor|performance|userspace|available|current|manual|maximal|minimal}"
+ exit 1
+fi
+
+# Check if cpufreq is loaded
+if [ ! -d /sys/devices/system/cpu/cpu0/cpufreq ]
+then
+ echo "E: no cpu driver loaded (or sysfs not mounted)."
+ exit 1
+fi
+
+# Change directory
+cd /sys/devices/system/cpu
+
+case "${1}" in
+ gov|governor)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ echo "${CPU}: current governor `cat scaling_governor`."
+ done
+ ;;
+
+ per|performance)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+
+ echo "${CPU}: current governor `cat scaling_governor`."
+
+ if [ "`cat scaling_governor`" = "performance" ]
+ then
+ echo "${CPU}: governor already set to `cat scaling_governor`."
+ else
+ cat scaling_available_governors | grep -q "performance"
+
+ if [ "${?}" = "0" ]
+ then
+ echo "performance" > scaling_governor
+ echo "${CPU}: governor set to `cat scaling_governor`."
+ else
+ echo "E: unavailable governor performance."
+ exit 1
+ fi
+ fi
+ done
+ ;;
+
+ use|userspace)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+
+ echo "${CPU}: current governor `cat scaling_governor`."
+
+ if [ "`cat scaling_governor`" = "userspace" ]
+ then
+ echo "${CPU}: governor already set to `cat scaling_governor`."
+ else
+ cat scaling_available_governors | grep -q "userspace"
+
+ if [ "${?}" = "0" ]
+ then
+ echo "userspace" > scaling_governor
+ echo "${CPU}: governor set to `cat scaling_governor`."
+ else
+ echo "E: unavailable governor userspace."
+ exit 1
+ fi
+ fi
+ done
+ ;;
+
+ ava|available)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ echo "${CPU}: available frequencies: `cat scaling_available_frequencies`."
+ echo "${CPU}: available governors: `cat scaling_available_governors`."
+ done
+ ;;
+
+ cur|current)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ echo "${CPU}: current frequency `cat scaling_cur_freq`kHz."
+
+ if [ "`cat scaling_cur_freq`" = "`cat scaling_max_freq`" ]
+ then
+ echo "${CPU}: frequency set to maximum."
+ elif [ "`cat scaling_cur_freq`" = "`cat scaling_min_freq`" ]
+ then
+ echo "${CPU}: frequency set to minimum."
+ fi
+ done
+ ;;
+
+ man|manual)
+ if [ -z "${2}" ]
+ then
+ echo "E: no frequency specified."
+ exit 1
+ fi
+
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ cat scaling_available_frequencies | grep -q "${2}"
+
+ if [ "${?}" = "0" ]
+ then
+ echo "${CPU}: current frequency `cat scaling_cur_freq`kHz."
+
+ if [ "`cat scaling_cur_freq`" = ${2} ]
+ then
+ echo "${CPU}: frequency already set to `cat scaling_cur_freq`kHz."
+ else
+ if [ "`cat scaling_governor`" = "userspace" ]
+ then
+ echo "${2}" > scaling_setspeed
+ echo "${CPU}: frequency set to `cat scaling_cur_freq`kHz."
+ else
+ echo "E: wrong governor `cat scaling_governor`."
+ exit 1
+ fi
+ fi
+ else
+ echo "${CPU}: current frequency `cat scaling_cur_freq`kHz."
+ echo "E: unavailable frequency ${2}kHz."
+ exit 1
+ fi
+ done
+ ;;
+
+ max|maximal)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ echo "${CPU}: current frequency `cat scaling_cur_freq`kHz."
+
+ if [ "`cat scaling_max_freq`" = "`cat scaling_cur_freq`" ]
+ then
+ echo "${CPU}: frequency already set to maximum."
+ else
+ if [ "`cat scaling_governor`" = "userspace" ]
+ then
+ cat scaling_max_freq > scaling_setspeed
+ echo "${CPU}: frequency set to `cat scaling_cur_freq`kHz."
+ else
+ echo "E: wrong governor `cat scaling_governor`."
+ exit 1
+ fi
+ fi
+ done
+ ;;
+
+ min|minimal)
+ for CPU in cpu*
+ do
+ cd /sys/devices/system/cpu/"${CPU}"/cpufreq
+ echo "${CPU}: current frequency `cat scaling_cur_freq`kHz."
+
+ if [ "`cat scaling_min_freq`" = "`cat scaling_cur_freq`" ]
+ then
+ echo "${CPU}: frequency already set to minimum."
+ else
+ if [ "`cat scaling_governor`" = "userspace" ]
+ then
+ cat scaling_min_freq > scaling_setspeed
+ echo "${CPU}: frequency set to `cat scaling_cur_freq`kHz."
+ else
+ echo "E: wrong governor `cat scaling_governor`."
+ exit 1
+ fi
+ fi
+ done
+ ;;
+esac
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/cpufreqs
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/halt
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/halt 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/halt 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sudo sh -c "/sbin/halt"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/halt
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/md5sums
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/md5sums 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/md5sums 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+# md5sums.sh - Generate signed MD5 message digests files
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+Passphrase ()
+{
+ if [ -z "${PASSPHRASE}" ]
+ then
+ echo -n " * Enter passphrase: "
+ read -s -t 60 PASSPHRASE
+ echo
+ echo
+ fi
+
+ if [ -z "${PASSPHRASE}" ]
+ then
+ Passphrase
+ fi
+
+ trap "if [ ! -z ${PASSPHRASE} ]; then export PASSPHRASE=; fi; exit 0" 0 2 15
+}
+
+Md5sum ()
+{
+ if [ -z "${PASSPHRASE}" ]
+ then
+ Passphrase
+ fi
+
+ # Remove old digests
+ rm -f MD5SUM*
+
+ if [ ! -z "`ls`" ]
+ then
+ # Create digest
+ md5sum * > MD5SUMS
+
+ # Sign digest
+ echo "${PASSPHRASE}" | gpg --quiet --passphrase-fd 0 --clearsign MD5SUMS
+ mv -f MD5SUMS.asc MD5SUMS
+ fi
+}
+
+Md5check ()
+{
+ if [ -r MD5SUMS ]
+ then
+ gpg --verify MD5SUMS
+ md5sum -c MD5SUMS
+ elif [ -f MD5SUMS ]
+ then
+ echo "W: cannot read `pwd`/MD5SUMS: Permission denied."
+ fi
+}
+
+Main ()
+{
+ case "${1}" in
+ -c|--check)
+ Md5check
+ ;;
+
+ -cc|--check-recursive)
+ for DIRECTORY in *
+ do
+ if [ -d "${DIRECTORY}" ]
+ then
+ cd "${DIRECTORY}"
+ Md5check
+ cd ..
+ fi
+ done
+ ;;
+
+ -ccc|--check-double-recursive)
+ for PARENT_DIRECTORY in *
+ do
+ if [ -d "${PARENT_DIRECTORY}" ]
+ then
+ cd "${PARENT_DIRECTORY}"
+ "${0}" --check-recursive
+ cd ..
+ fi
+ done
+ ;;
+
+ --clean)
+ find "`pwd`" -type f -name "MD5SUM*" | xargs rm -f
+ ;;
+
+ --list)
+ find "`pwd`" -type f -name "MD5SUM*"
+ ;;
+
+ -s|--sum)
+ Md5sum
+ ;;
+
+ -ss|--sum-recursive)
+ for DIRECTORY in *
+ do
+ if [ -d "${DIRECTORY}" ]
+ then
+ cd "${DIRECTORY}"
+ Md5sum
+ cd ..
+ fi
+ done
+ ;;
+
+ -sss|--sum-double-recursive)
+ for PARENT_DIRECTORY in *
+ do
+ if [ -d "${PARENT_DIRECTORY}" ]
+ then
+ cd "${PARENT_DIRECTORY}"
+
+ for DIRECTORY in *
+ do
+ if [ -d "${DIRECTORY}" ]
+ then
+ cd "${DIRECTORY}"
+ Md5sum
+ cd ..
+ fi
+ done
+
+ cd ..
+ fi
+ done
+ ;;
+
+ -h|--help)
+ echo "md5sums.sh - Generate signed MD5 message digests files"
+ echo
+ echo "Usage: `basename ${0}` [-c|--check] [-cc|--recursive-check] [-ccc|--double-recursive-check]"
+ echo "Usage: `basename ${0}` [--clean] [--list]"
+ echo "Usage: `basename ${0}` [-s|--sum] [-ss|--sum-recursive] [-sss|--sum-double-recursive]"
+ exit 1
+ ;;
+
+ *)
+ Md5sum
+ ;;
+ esac
+}
+
+Main "${@}"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/md5sums
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/pss
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/pss 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/pss 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# pss.sh - Greps through list of the current processes
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+GREP_OPTIONS="--color=auto -i"
+PS_OPTIONS="-eaf"
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ]
+then
+ echo "pss.sh - Greps through list of the current processes"
+ echo
+ echo "Usage: `basename ${0}` [GREP_PATTERN]"
+ exit 1
+fi
+
+# Process data
+ps "${PS_OPTIONS}" | grep -e "${1}"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/pss
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/reboot
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/reboot 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/reboot 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sudo sh -c "/sbin/reboot"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/reboot
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-disk
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-disk 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-disk 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sudo sh -c "echo 'disk' > /sys/power/state"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-disk
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-mem
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-mem 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-mem 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sudo sh -c "echo 'mem' > /sys/power/state"
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/suspend-mem
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/vi-mtime
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/vi-mtime 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/vi-mtime 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# vi-mtime.sh - Editing files without changing mtime
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+# Show help
+if [ -z "${1}" ]
+then
+ echo "vi-mtime.sh - Editing files without changing mtime"
+ echo
+ echo "Usage: `basename ${0}` FILE"
+ exit 1
+fi
+
+# Saving mtime
+touch -r "${1}" ."${1}".mtime
+
+# Process file
+vi "${1}"
+
+# Restoring mtime
+touch -r ."${1}".mtime "${1}"
+rm -f ."${1}".mtime
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/vi-mtime
___________________________________________________________________
Name: svn:executable
+ *
Added: configs/daniel/config/chroot_localincludes/usr/local/bin/vis
===================================================================
--- configs/daniel/config/chroot_localincludes/usr/local/bin/vis 2007-04-22 08:13:37 UTC (rev 1118)
+++ configs/daniel/config/chroot_localincludes/usr/local/bin/vis 2007-04-22 08:13:56 UTC (rev 1119)
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# vis.sh - Editing files recursively
+#
+# This script is written by Daniel Baumann <daniel at debian.org>
+# and hereby placed in the public domain (no rights reserved).
+
+set -e
+
+# Show help
+if [ "${1}" = "-h" ] || [ "${1}" = "--help}" ]
+then
+ echo "vis.sh - Editing files recursively"
+ echo
+ echo "Usage: `basename ${0}` [-r|--recursive]"
+ exit 1
+fi
+
+case "${1}" in
+ -r|--recursive)
+ find "`pwd`" -type f -exec vi {} \;
+ ;;
+
+ *)
+ find "`pwd`" -maxdepth 1 -type f -exec vi {} \;
+ ;;
+esac
Property changes on: configs/daniel/config/chroot_localincludes/usr/local/bin/vis
___________________________________________________________________
Name: svn:executable
+ *
More information about the Debian-live-changes
mailing list