summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/Xshutdown.sh34
-rwxr-xr-xsbin/asound_backup.sh11
-rwxr-xr-xsbin/asound_pulse_disable.sh8
-rwxr-xr-xsbin/asound_pulse_enable.sh26
-rwxr-xr-xsbin/keyword_package26
-rwxr-xr-xsbin/set_governor37
6 files changed, 142 insertions, 0 deletions
diff --git a/bin/Xshutdown.sh b/bin/Xshutdown.sh
new file mode 100755
index 0000000..eeae1ba
--- /dev/null
+++ b/bin/Xshutdown.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# export Display for GUI
+export DISPLAY=":0.0"
+
+# Use as shutdown
+SHUTDOWN=/sbin/shutdown
+
+case "$1" in
+ shutdown)
+ Xdialog --title Shutdown --center --beep --yesno "Really shutdown the system?" 0 0 \
+ && (sync ; exec ${SHUTDOWN} -h now)
+ ;;
+ reboot)
+ Xdialog --title Reboot --center --beep --yesno "Do you want to reboot the system?" 0 0 \
+ && (sync ; exec ${SHUTDOWN} -r now)
+ ;;
+ standby)
+ Xdialog -title Standby --center --beep --yesno "Do you want to suspend to ram?" 0 0 \
+ && (sync ; exec hibernate-ram )
+ ;;
+ ask)
+ CHOICE=$(Xdialog --stdout --title 'Choose!' --menubox 'Choose your destiny!' 10 50 3 \
+ standby "Suspend to ram." \
+ shutdown "Shutdown your system." \
+ reboot " Reboot this system.")
+ [ -z "$CHOICE" ] && exit 1
+ exec $0 $CHOICE
+ ;;
+ *)
+ echo $1
+ echo 1>&2 "$0 (shutdown|reboot|standby|ask)"
+ exit 1
+ ;;
+esac
diff --git a/sbin/asound_backup.sh b/sbin/asound_backup.sh
new file mode 100755
index 0000000..0e7912e
--- /dev/null
+++ b/sbin/asound_backup.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ "`ls /etc/asound/ | wc -l`" -lt 10 ]
+then
+ for i in `seq 0 9`
+ do
+ touch "/etc/asound/asound.conf.bak_${i}"
+ done
+fi
+
+cat /etc/asound.conf > /etc/asound/"`ls -rt /etc/asound/ | head -n 1`"
diff --git a/sbin/asound_pulse_disable.sh b/sbin/asound_pulse_disable.sh
new file mode 100755
index 0000000..ff929e2
--- /dev/null
+++ b/sbin/asound_pulse_disable.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+asound_backup.sh
+
+tmp_file="`mktemp`"
+echo "`cat /etc/asound.conf`
+" | sed "/pcm.\!default/,/}/{H;d};/ctl.\!default/,/}/{H;d};x;/\n[^#\n]*pcm.\!default.*\n[^#\n]*type pulse.*\n[^#\n]*\}/{d};/\n[^#\n]*ctl.\!default.*\n[^#\n]*type pulse.*\n[^#\n]*\}/{d}" > $tmp_file
+cat -s $tmp_file > /etc/asound.conf
diff --git a/sbin/asound_pulse_enable.sh b/sbin/asound_pulse_enable.sh
new file mode 100755
index 0000000..c3d0cae
--- /dev/null
+++ b/sbin/asound_pulse_enable.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+asound_backup.sh
+
+tmpfile=`mktemp`
+if [ -z "`grep "^[^#]*ctl.\!default" /etc/asound.conf`" ]
+then
+ echo "ctl.!default {
+ type pulse
+}
+" > $tmpfile
+
+ cat -s /etc/asound.conf >> $tmpfile
+ cat -s "$tmpfile" > /etc/asound.conf
+fi
+
+if [ -z "`grep "^[^#]*pcm.\!default" /etc/asound.conf`" ]
+then
+ echo "pcm.!default {
+ type pulse
+}
+" > $tmpfile
+
+ cat -s /etc/asound.conf >> $tmpfile
+ cat -s "$tmpfile" > /etc/asound.conf
+fi
diff --git a/sbin/keyword_package b/sbin/keyword_package
new file mode 100755
index 0000000..93b93d9
--- /dev/null
+++ b/sbin/keyword_package
@@ -0,0 +1,26 @@
+#!/bin/sh
+SPECIAL_LINE_COUNT=$(grep -nE "(/\*)|(\*/)" /etc/portage/package.keywords | tail -n 1 | awk -F: '{ print $1 }')
+TMP_FILE=$(mktemp)
+
+head -n $SPECIAL_LINE_COUNT /etc/portage/package.keywords > $TMP_FILE
+
+(
+ while [ -n "${1}" ] ; do
+ LINE="${1} ~x86"
+ if [ -z "$(grep "^${LINE}$" /etc/portage/package.keywords)" ]
+ then
+ echo "${LINE}"
+ echo "adding \"${LINE}\" to /etc/portage/package.keywords" | logger -st $(basename $0)
+ else
+ echo "Don't adding \"${1}\". Already there." > /dev/stderr
+ fi
+
+ shift 1
+ done
+
+ tail -n $(($(cat /etc/portage/package.keywords | wc -l)-$SPECIAL_LINE_COUNT)) /etc/portage/package.keywords
+) | grep -v "^$" | sort | awk -F/ '{ if (OLD_PREFIX!=$1) print ""; OLD_PREFIX=$1 ; print }' >> $TMP_FILE
+
+mv /etc/portage/package.keywords /etc/portage/package.keywords.bak
+mv $TMP_FILE /etc/portage/package.keywords
+chmod +r /etc/portage/package.keywords
diff --git a/sbin/set_governor b/sbin/set_governor
new file mode 100755
index 0000000..08f68e5
--- /dev/null
+++ b/sbin/set_governor
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Script to display and set (checked) the governors for the both CPU Cores (f.e. from the Core2Duo)
+# (c) Alexander Sulfrian 2007
+# Licence: GPL v3
+#
+
+
+if [ -z "$1" ]
+then
+ activ_governor_cpu0=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
+ activ_governor_cpu1=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor`
+ echo "active governors"
+ echo "CPU 0: ${activ_governor_cpu0}"
+ echo "CPU 1: ${activ_governor_cpu1}"
+ exit 1
+fi
+
+
+governor_avalible=`sed 's/ \(.\)/\n\1/g;s/ $//g' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep "^${1}\$"`
+if [ -z "$governor_avalible" ]
+then
+ avalible_governors=`sed 's/ \(.\)/|\1/g;s/ $//g' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`
+ echo "Usage:"
+ echo "$0 [${avalible_governors}]"
+ exit 2
+fi
+
+echo "$1" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+echo "$1" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+
+activ_governor_cpu0=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
+activ_governor_cpu1=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor`
+echo "active governors"
+echo "CPU 0: ${activ_governor_cpu0}"
+echo "CPU 1: ${activ_governor_cpu1}"
+exit 0