From e405bbcd89bcb47447d274584051c0eeaae6e3e5 Mon Sep 17 00:00:00 2001 From: Severin Kaderli Date: Thu, 13 Dec 2018 21:54:40 +0100 Subject: [PATCH] Comment the scripts in system/bin Signed-off-by: Severin Kaderli --- system/bin/increase_volume.sh | 14 ++++++++++++++ system/bin/resolution.sh | 16 ++++++++++++++-- system/bin/screenlock.sh | 15 ++++++++++++++- system/bin/server.sh | 19 +++++++++++++------ system/bin/twitch.sh | 20 +++++++++++++------- system/bin/upgrade.sh | 13 ++++++++++++- system/bin/utils.sh | 18 ++++++++++++++---- 7 files changed, 94 insertions(+), 21 deletions(-) diff --git a/system/bin/increase_volume.sh b/system/bin/increase_volume.sh index c20ef3c..c9e2310 100755 --- a/system/bin/increase_volume.sh +++ b/system/bin/increase_volume.sh @@ -1,4 +1,18 @@ #!/bin/bash +# +# SCRIPT NAME: +# increase_volume.sh +# +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This script uses pamixer to increase the volume by 5% as long +# as the current volume is less than 150%. I call this script +# using custom i3 keybindings. +# +# USAGE: +# ./increase_volume.sh if [[ $(pamixer --get-volume) -lt 150 ]]; then pamixer -i 5 --allow-boost fi diff --git a/system/bin/resolution.sh b/system/bin/resolution.sh index 8d3101a..5d04707 100755 --- a/system/bin/resolution.sh +++ b/system/bin/resolution.sh @@ -1,4 +1,16 @@ -#!/bin/sh +#!/bin/bash +# +# SCRIPT NAME: +# resolution.sh +# +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This is the script that is used to setup my monitors. This script +# is used by i3 and lightdm. +# +# USAGE: +# ./resolution.sh xrandr --setprovideroutputsource modesetting NVIDIA-0 -#xrandr --auto xrandr --output HDMI3 --off --output HDMI2 --off --output HDMI1 --mode 1280x1024 --pos 80x56 --rotate normal --output eDP1 --primary --mode 1920x1080 --pos 1360x0 --rotate normal --output DP3 --off --output DP2 --off --output DP1 --off diff --git a/system/bin/screenlock.sh b/system/bin/screenlock.sh index 3bc27de..212a023 100755 --- a/system/bin/screenlock.sh +++ b/system/bin/screenlock.sh @@ -1,2 +1,15 @@ #!/bin/bash -dm-tool lock +# +# SCRIPT NAME: +# screenlock.sh +# +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This script locks the screen using lightdm. This script is called +# using a custom i3 keybinding. +# +# USAGE: +# ./screenlock.sh +dm-tool lock \ No newline at end of file diff --git a/system/bin/server.sh b/system/bin/server.sh index eab73ba..1455cd7 100755 --- a/system/bin/server.sh +++ b/system/bin/server.sh @@ -1,16 +1,23 @@ #!/bin/bash +# +# SCRIPT NAME: +# server.sh # -# This script allows me to quickly start or stop apache2 and mysql. +# AUTHOR: +# Severin Kaderli # -# Usage: ./server.sh [start|stop] - -if [ "$1" == "start" ]; then +# DESCRIPTION: +# This script starts / stops the Apache and MariaDB servers. +# +# USAGE: +# ./server.sh start|stop +if [ "${1}" == "start" ]; then sudo systemctl start httpd.service sudo systemctl start mariadb.service -elif [ "$1" == "stop" ]; then +elif [ "${1}" == "stop" ]; then sudo systemctl stop httpd.service sudo systemctl stop mariadb.service else - echo "'$1' is an unknown option" + echo "${1} is an unknown option" exit 0 fi diff --git a/system/bin/twitch.sh b/system/bin/twitch.sh index adfe1c8..0843c8b 100755 --- a/system/bin/twitch.sh +++ b/system/bin/twitch.sh @@ -1,11 +1,17 @@ #!/bin/bash +# +# SCRIPT NAME: +# twitch.sh # -# This script simply uses livestreamer to -# stream a twitch stream. It's only a little shortcut, so I don't have to -# type so much. +# AUTHOR: +# Severin Kaderli # -# Usage: ./twitch.sh USERNAME [RESOLUTION] - +# DESCRIPTION: +# This script loads a Twitch livestream in a local video player +# using streamlink. +# +# USAGE: +# ./twitch.sh USERNAME [RESOLUTION] if [[ -z $1 ]]; then echo "Please enter a username!" exit 1 @@ -14,7 +20,7 @@ fi if [[ -z $2 ]]; then resolution="best" else - resolution="$2" + resolution="${2}" fi -streamlink -v -l debug "twitch.tv/$1" "$resolution" +streamlink "https://twitch.tv/${1}" "${resolution}" diff --git a/system/bin/upgrade.sh b/system/bin/upgrade.sh index 6eb4520..0160ca1 100755 --- a/system/bin/upgrade.sh +++ b/system/bin/upgrade.sh @@ -1,6 +1,17 @@ #!/bin/bash +# +# SCRIPT NAME: +# upgrade.sh # -# Author: Severin Kaderli +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This script upgrades all pacman packages and globally installed +# npm packages. +# +# USAGE: +# ./upgrade.sh . utils.sh print_header "Update packages" diff --git a/system/bin/utils.sh b/system/bin/utils.sh index 91e657f..e3174e0 100755 --- a/system/bin/utils.sh +++ b/system/bin/utils.sh @@ -1,7 +1,17 @@ #!/bin/bash +# +# SCRIPT NAME: +# utils.sh # -# Author: Severin Kaderli - +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This script provides functions that I use in my other scripts. It is +# not supposed to be run directly. +# +# USAGE: +# Source this script in the needed script. ####################################### # Directory variables ####################################### @@ -32,8 +42,8 @@ function print_header() { # Creates the given directory in the home directory # $1: Directory function create_directory() { - echo -e "- Creating directory ${YELLOW}${HOME}/${dir}${RESET}" - mkdir -p "${HOME}/${dir}" + echo -e "- Creating directory ${YELLOW}${HOME}/${1}${RESET}" + mkdir -p "${HOME}/${1}" } # Creates a symlink of the given file from the home directory to here.