diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/backup.sh | 9 | ||||
| -rwxr-xr-x | scripts/change_fan.sh | 79 | ||||
| -rwxr-xr-x | scripts/format_displays.sh (renamed from configs/i3/format_displays.sh) | 2 |
3 files changed, 89 insertions, 1 deletions
diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100755 index 0000000..caf5b7b --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +## +# Create full tree backups to specified media + +GLOBAL_MEDIA_BLOCK=$1 + +echo "Beginning rsync full system backup / -> $GLOBAL_MEDIA_BLOCK" +rsync -SHaAX --delete --info=progress2 --exclude={"/dev/*", "/proc/*", "/sys/*", "/tmp/*", "/run/*", "/mnt/*", "/lost+found"} / $1 diff --git a/scripts/change_fan.sh b/scripts/change_fan.sh new file mode 100755 index 0000000..b290700 --- /dev/null +++ b/scripts/change_fan.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +## It would be nice to check the system and dynamically figure out which fan controller +## is being used...but I don't need that right now. + +# echo "1" > /sys/devices/platform/applesmc.768/fan1_manual +# echo "9000" > /sys/devices/platform/applesmc.768/fan1_output +# cat /sys/devices/platform/applesmc.768/fan1_output + +FAN_DIR=/sys/devices/platform/applesmc.768 +FAN_OUT=$FAN_DIR/fan1_output +FAN_MANUAL=$FAN_DIR/fan1_manual +MAX_FAN=$(cat $FAN_DIR/fan1_max) +MIN_FAN=$(cat $FAN_DIR/fan1_min) + +function toggle_mbpfan() { + SHOULD_DEACTIVE=$1 + IS_ACTIVE=$(systemctl is-active mbpfan) + if [[ "$SHOULD_DEACTIVE" == "false" ]]; then + echo "force deactive!" + echo "0" > "$FAN_MANUAL" + sudo systemctl start mbpfan + return + elif [[ "$IS_ACTIVE" == "active" || "$SHOULD_DEACTIVE" == "true" ]]; then + sudo systemctl stop mbpfan + echo "force active!" + echo "1" > "$FAN_MANUAL" + return + else + echo "force deactive and start mbpfan" + echo "there!" + echo "0" > "$FAN_MANUAL" + sudo systemctl start mbpfan + return + fi +} + +function increase_fan() { + CURR_SPEED=$(cat $FAN_DIR/fan1_output) + NEXT_SPEED=$(echo - | awk -v curr="$CURR_SPEED" '{printf "%1.0f", (curr + 500)}') + + # deactivate mbpfan + toggle_mbpfan "true" + + if [[ $NEXT_SPEED -lt $MAX_FAN ]]; then + echo $NEXT_SPEED > "$FAN_OUT" + else + echo $MAX_FAN > "$FAN_OUT" + fi +} + +function decrease_fan() { + CURR_SPEED=$(cat $FAN_DIR/fan1_output) + NEXT_SPEED=$(echo - | awk -v curr="$CURR_SPEED" '{printf "%1.0f", (curr - 500)}') + + # deactivate mbpfan + toggle_mbpfan "true" + + if [[ $NEXT_SPEED -gt $MIN_FAN ]]; then + echo $NEXT_SPEED > "$FAN_OUT" + else + # no reason to ever this low. + # let the system take back over, since the user probably forgot + toggle_mbpfan "false" + fi +} + +while getopts ":idt" opt; do + case ${opt} in + t) toggle_mbpfan + ;; + i) increase_fan + ;; + d) decrease_fan + ;; + \? ) + ;; + esac +done diff --git a/configs/i3/format_displays.sh b/scripts/format_displays.sh index 68279d7..acb2638 100755 --- a/configs/i3/format_displays.sh +++ b/scripts/format_displays.sh @@ -4,7 +4,7 @@ DISPLAYS=( $(xrandr | grep " connected" | awk '{print $1}') ) declare -A DISP_RES -BG_IMG="~/pictures/Yosemite-Color-Block.png" +BG_IMG="~/.setup/des/i3/assets/wallpaper/yosemite_color_block.png" VERBOSE="" if_echo () { |
