diff options
Diffstat (limited to 'local')
| -rwxr-xr-x | local/bin/allsync | 63 | ||||
| -rwxr-xr-x | local/bin/cloud | 15 | ||||
| -rwxr-xr-x | local/bin/elektroline00 | 1 | ||||
| -rwxr-xr-x | local/bin/new-flake-dev | 7 | ||||
| -rwxr-xr-x | local/bin/project-test | 30 | ||||
| -rwxr-xr-x | local/bin/startsway | 7 |
6 files changed, 70 insertions, 53 deletions
diff --git a/local/bin/allsync b/local/bin/allsync index 6e537e2..70c9d29 100755 --- a/local/bin/allsync +++ b/local/bin/allsync @@ -8,21 +8,22 @@ notify_bar() { i3_astroid() { pkill -0 astroid || return 0 - find "/run/user/$(id -u)/i3" "/tmp/i3-$(id -un)".* -name ipc-socket\* 2>/dev/null | \ + find "/run/user/$(id -u)/i3" "/tmp/i3-$(id -un)".* -name ipc-socket\* 2>/dev/null | while read -r socket; do i3-msg -s "$socket" "exec astroid $*" - done + done } cron_enable() { pass mail/cynerd@email.cz >/dev/null # Cache keys if command -v crontab >/dev/null; then { - crontab -l + crontab -l echo "$cronline" } | crontab - else systemctl --user start allsync.timer + systemctl --user start davmail.service fi notify_bar } @@ -46,33 +47,33 @@ cron_enabled() { if [ "$#" -gt 0 ]; then case "$1" in - enable) - cron_enable - ;; - disable) + enable) + cron_enable + ;; + disable) + cron_disable + ;; + enabled) + cron_enabled + ;; + state) + if cron_enabled; then + echo "Enabled" + else + echo "Disabled" + fi + ;; + toggle) + if cron_enabled; then cron_disable - ;; - enabled) - cron_enabled - ;; - state) - if cron_enabled; then - echo "Enabled" - else - echo "Disabled" - fi - ;; - toggle) - if cron_enabled; then - cron_disable - else - cron_enable - fi - ;; - *) - echo "${0##*/}: Unknown argument: $1" >&2 - exit 1 - ;; + else + cron_enable + fi + ;; + *) + echo "${0##*/}: Unknown argument: $1" >&2 + exit 1 + ;; esac exit fi @@ -97,7 +98,6 @@ if [ "${ALLSYNC_FLOCK:-n}" != "y" ]; then exit 1 fi - sec() { echo -e '\e[1;34m==========' "$@" '==========\e[0m' } @@ -108,18 +108,15 @@ fail() { ecode=1 } - sec "Passwords" pass git pull || fail "Passwords pull failed" pass git push || fail "Passwords push failed" sec "Mail" -i3_astroid --start-polling mbsync -a || fail "Mail synchronization reported failure" notmuch new ~/.local/sbin/newmail-notify || fail "Mail notifications not sent" notmuch tag --batch --input="$HOME/.notmuch-tag-new" -i3_astroid --stop-polling notify_bar #sec "Calendar and contacts" diff --git a/local/bin/cloud b/local/bin/cloud index db6e717..187db18 100755 --- a/local/bin/cloud +++ b/local/bin/cloud @@ -19,8 +19,21 @@ while getopts "u" opt; do done if [ "$umount" = "n" ]; then + url="https://cloud.cynerd.cz/remote.php/dav/files/cynerd" + conf="$(mktemp)" + secrets="$(mktemp)" + trap 'rm -f "$conf" "$secrets"' EXIT HUP INT QUIT SEGV PIPE TERM + cat >"$conf" <<-EOF + [$path] + secrets ${secrets} + use_locks 0 + EOF + chmod 600 "$secrets" + echo "$url cynerd $(pass cynerd.cz/nextcloud/davfs)" >"$secrets" + sudo chown root "$secrets" sudo mkdir -p "$path" - sudo mount.davfs -o uid=1000,username=cynerd "https://cloud.cynerd.cz/remote.php/dav/files/cynerd" "$path" + sudo mount.davfs -o "conf=${conf}" -o uid=1000 "$url" "$path" + sudo rm -f "$secrets" else sudo umount "$path" fi diff --git a/local/bin/elektroline00 b/local/bin/elektroline00 index 7a21cd6..99664d2 100755 --- a/local/bin/elektroline00 +++ b/local/bin/elektroline00 @@ -20,6 +20,7 @@ done if [ "$umount" = "n" ]; then mount_cifs() { + sudo mkdir -p "$path/$2" sudo --preserve-env=PASSWD mount.cifs -o username=kkoci,uid=1000 "$1" "$path/$2" echo "Mounted $path/$2" } diff --git a/local/bin/new-flake-dev b/local/bin/new-flake-dev index 360a94e..c28f2fd 100755 --- a/local/bin/new-flake-dev +++ b/local/bin/new-flake-dev @@ -11,10 +11,15 @@ cat >./flake.nix <<"EOF" systems, nixpkgs, }: let - inherit (nixpkgs.lib) genAttrs; + inherit (nixpkgs.lib) genAttrs composeManyExtensions; forSystems = genAttrs (import systems); withPkgs = func: forSystems (system: func self.legacyPackages.${system}); in { + overlays = { + packages = final: prev: {}; + default = composeManyExtensions [self.overlays.packages]; + }; + devShells = withPkgs (pkgs: { default = with pkgs; mkShell { diff --git a/local/bin/project-test b/local/bin/project-test index e8c6261..feab447 100755 --- a/local/bin/project-test +++ b/local/bin/project-test @@ -15,21 +15,21 @@ print_help() { while [ -n "$1" ]; do case $1 in - -r|--ref) - shift - REF=$1 - ;; - -c|--count) - shift - REF=HEAD~$1 - ;; - --) - shift - break - ;; - *) - break - ;; + -r | --ref) + shift + REF=$1 + ;; + -c | --count) + shift + REF=HEAD~$1 + ;; + --) + shift + break + ;; + *) + break + ;; esac shift done diff --git a/local/bin/startsway b/local/bin/startsway index 3982c19..262a997 100755 --- a/local/bin/startsway +++ b/local/bin/startsway @@ -14,9 +14,10 @@ export MOZ_ENABLE_WAYLAND=1 # Java application do not display properly export _JAVA_AWT_WM_NONREPARENTING=1 -dbus="dbus-run-session" if [ "$(ps -o comm= 1)" = "systemd" ]; then - dbus="" + launch="systemd-cat --identifier=sway --stderr-priority=err" +else + launch="dbus-run-session" fi -exec $dbus sway +exec $launch sway |
