Commit c8ce8647 authored by yids's avatar yids
Browse files

- new function in HBL to check if files or dirs exist

- some fix in shorewall-notify
- added system folder with some things
parent 96a156ce
...@@ -98,5 +98,24 @@ execute () ...@@ -98,5 +98,24 @@ execute ()
fi fi
} }
#
# checks wether $1 is a file, a dir, or does not exist
# returns 0 if $1 is file, returns 1 if $1 is a dir, and 2 if not existing
# usage check_file [filename]
#
check_file()
{
if [[ -f $1 ]];
then
printf "$1 exists and is a file. \n"
return 0
elif [[ -d $1 ]];
then
printf "$1 exists and is a directory. \n"
return 1
else
printf "$1 does not exist. \n"
return 2
fi
}
...@@ -5,7 +5,7 @@ export NUMARGS=0 ...@@ -5,7 +5,7 @@ export NUMARGS=0
export USAGE="shorewall-notify takes no arguments" export USAGE="shorewall-notify takes no arguments"
export SRCROOT="../" export SRCROOT="../"
source "$SRCROOT/HBL" source "$SRCROOT/HBL"
XUSER="" XUSER="yids"
check_root check_root
check_dependencies $DEPS check_dependencies $DEPS
...@@ -19,8 +19,8 @@ while [[ true ]] ; do ...@@ -19,8 +19,8 @@ while [[ true ]] ; do
PART1=$(echo $MESSAGE | cut -d ' ' -f 7-8) PART1=$(echo $MESSAGE | cut -d ' ' -f 7-8)
PART2=$(echo $MESSAGE | cut -d ' ' -f 11-12) PART2=$(echo $MESSAGE | cut -d ' ' -f 11-12)
PART3=$(echo $MESSAGE | cut -d ' ' -f 18-21) PART3=$(echo $MESSAGE | cut -d ' ' -f 18-21)
# echo $PART1
if [[ $(echo $PART1 | cut -c 1-9) = "Shorewall" ]]; if [[ $PART1 == *"Shorewall"* ]];
then then
NOTIFICATION="\"$PART1 $PART2 $PART3\"" NOTIFICATION="\"$PART1 $PART2 $PART3\""
#echo $NOTIFICATION #echo $NOTIFICATION
......
#!/bin/bash
export DEPS=""
export NUMARGS=0
export USAGE=""
export SRCROOT="../"
source "$SRCROOT/HBL"
check_dependencies $DEPS
check_num_args $#
check_root
echo y > /sys/module/snd_hda_intel/parameters/power_save_controller
for i in /sys/bus/usb/devices/*/power/level; do echo auto > $i; done
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
ethtool -s eth0 wol d
hciconfig hci0 down
echo disable > /proc/acpi/ibm/bluetooth
#!/bin/bash
echo - | awk "{printf \"%.1f\", \
$(( \
$(cat /sys/class/power_supply/BAT0/current_now) $(cat /sys/class/power_supply/BAT0/voltage_now)
)) / 1000000000000 }"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment