script changes
This commit is contained in:
parent
6e8683c725
commit
775a43810c
6 changed files with 108 additions and 25 deletions
|
@ -1,14 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
if [ ! -d "./.git" ]; then
|
||||
echo "missing .git dir!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Last commit: $(git log | grep 'Date' | cut -d ' ' -f 4- | head -1)"
|
||||
read -r -p "Date: " date
|
||||
last_commit() {
|
||||
printf "Last commit date: %s\n" "$(git log | grep 'Date' | cut -d ' ' -f 4- | head -1)"
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "gdt: Commit with fake date"
|
||||
echo
|
||||
echo "USAGE"
|
||||
echo " $0 -[dl] <git command>"
|
||||
echo
|
||||
echo "ARGS"
|
||||
echo " -d, --date Sets commit and author date"
|
||||
echo " -h, --help Prints this message"
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "ERROR: $1"
|
||||
echo
|
||||
help >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"-d"|"--date")
|
||||
shift
|
||||
[ -n "$1" ] && date="$1" || die "Missing date"
|
||||
shift
|
||||
;;
|
||||
"-h"|"--help")
|
||||
help
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
last_commit
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$#" -lt "1" ]; then
|
||||
die "Missing commit message!"
|
||||
fi
|
||||
|
||||
export GIT_AUTHOR_DATE="${date}"
|
||||
export GIT_COMMITTER_DATE="${date}"
|
||||
|
||||
git "$@"
|
||||
git commit -am "$@"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
OUTPUT="${1:-"DP-1"}"
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${OUTPUT}"
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${OUTPUT}"
|
||||
xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${OUTPUT}"
|
|
@ -1,12 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
IFNAME="wg_lva"
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
|
||||
vpn_sock() {
|
||||
echo echoing "$@"
|
||||
[ -p "$PIPE" ] && echo "$@" > $PIPE
|
||||
}
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
|
@ -16,8 +10,6 @@ while [ "$#" -gt 0 ]; do
|
|||
;;
|
||||
'-v'|'--verbose') VERBOSE=1
|
||||
;;
|
||||
'--visual')
|
||||
;;
|
||||
*) echo "Wrong argument!"; exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -35,15 +27,15 @@ UP_NAME="$(ip link show | grep 'wg' | cut -d ' ' -f 2 | sed 's/://')"
|
|||
IFNAME="${IFNAME}${DPI}"
|
||||
if [ -n "${UP_NAME}" ]; then
|
||||
if [ "${UP_NAME}" != "${IFNAME}" ]; then
|
||||
vpn_sock replace "${UP_NAME}" "${IFNAME}"
|
||||
wg-quick down "${UP_NAME}"
|
||||
wg-quick up "${IFNAME}"
|
||||
else
|
||||
vpn_sock down "${UP_NAME}"
|
||||
wg-quick down "${UP_NAME}"
|
||||
fi
|
||||
else
|
||||
vpn_sock up "${IFNAME}"
|
||||
wg-quick up "${IFNAME}"
|
||||
fi
|
||||
|
||||
read -r < "$PIPE"
|
||||
pkill -36 dwmblocks
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
49
.local/bin/scripts/vpnd
Executable file
49
.local/bin/scripts/vpnd
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
|
||||
[ -p $PIPE ] && exit 1
|
||||
[ "$(id -u)" != "0" ] && exit 1
|
||||
|
||||
trap 'die' SIGTERM SIGQUIT SIGINT
|
||||
|
||||
declare -a CONFIGS
|
||||
for config in /etc/wireguard/*; do
|
||||
config="$(basename "$config")"
|
||||
CONFIGS+=("${config%.conf}")
|
||||
done
|
||||
|
||||
COMMANDS=("up" "down")
|
||||
|
||||
die() {
|
||||
rm $PIPE
|
||||
exit 0
|
||||
}
|
||||
|
||||
in_arr() {
|
||||
declare -n arr="$2"
|
||||
|
||||
for value in "${arr[@]}"; do
|
||||
[ "$value" = "$1" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
main() {
|
||||
mkfifo $PIPE -m666
|
||||
|
||||
while :; do
|
||||
read -r cmd ifname < $PIPE
|
||||
|
||||
if ! in_arr "$ifname" "CONFIGS"; then
|
||||
echo "ERROR: Invalid interface $ifname" > $PIPE
|
||||
elif ! in_arr "$cmd" "COMMANDS"; then
|
||||
echo "ERROR: Invalid command $cmd" > $PIPE
|
||||
else
|
||||
wg-quick "$cmd" "$ifname" > $PIPE 2>&1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main
|
7
.local/bin/scripts/wg-quick
Executable file
7
.local/bin/scripts/wg-quick
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
PIPE="/var/run/vpnd.sock"
|
||||
|
||||
[ -p $PIPE ] &&
|
||||
echo "$@" > $PIPE &&
|
||||
cat < $PIPE
|
8
.xinitrc
8
.xinitrc
|
@ -1,8 +1,10 @@
|
|||
. ${HOME}/.config/X11/xprofile
|
||||
. "${HOME}"/.config/X11/xprofile
|
||||
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && eval $(/usr/bin/dbus-launch --exit-with-session --sh-syntax)
|
||||
dbus-update-activation-environment --verbose --all
|
||||
xr
|
||||
. ${HOME}/.config/X11/autostart
|
||||
. "${HOME}"/.config/X11/autostart
|
||||
|
||||
exec ssh-agent ${HOME}/.local/src/dwm/dwm
|
||||
exec ssh-agent "${HOME}"/.local/src/dwm/dwm
|
||||
# exec ssh-agent /usr/bin/dwm
|
||||
|
||||
# vim: ft=sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue