From 9e932b683177ec65b0a602974528653bab1b574c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Mon, 19 Oct 2020 22:13:40 +0200 Subject: symlink the scripts --- .local/bin/backup.sh | 36 ------------------------------------ .local/bin/tagmail.sh | 44 -------------------------------------------- bin/backup.sh | 36 ++++++++++++++++++++++++++++++++++++ bin/tagmail.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ install.scm | 10 ++++++++++ 5 files changed, 90 insertions(+), 80 deletions(-) delete mode 100755 .local/bin/backup.sh delete mode 100755 .local/bin/tagmail.sh create mode 100755 bin/backup.sh create mode 100755 bin/tagmail.sh diff --git a/.local/bin/backup.sh b/.local/bin/backup.sh deleted file mode 100755 index 52ca53a..0000000 --- a/.local/bin/backup.sh +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/bash - -backup_local(){ - # external program to supply the passphrase: - export BORG_PASSCOMMAND="pass show $1" # repo pass first arg - - # Create Local Backups - echo $( date ) "Creating Local Backups ..." - REPOSITORY=$2 # repo vault path second arg - shift 2 # consume the first 2 arguments - borg create --list --filter AME --stats --compression=lz4 \ - --progress --exclude '*.pyc' \ - --exclude '*/.mypy_cache/' \ - --exclude '*/.notmuch' \ - --exclude '*/node_modules' \ - --exclude '*/js/compiled' \ - --exclude '*/mpd/log' \ - --exclude '*/venv/' \ - --exclude '*/.tox/' \ - --exclude '*.elc' \ - $REPOSITORY::'{hostname}-{user}-{utcnow:%Y-%m-%dT%H:%M:%S}' \ - $@ # all the dirs to bac - - # Prune Local Backups - echo $( date ) "Pruning local repository ..." - - borg prune --verbose --stats --list \ - --prefix='{hostname}-{user}-' \ - --keep-daily 7 \ - --keep-weekly 4 \ - --keep-monthly 6 $REPOSITORY -} - -backup_local borgbackup ssh://backup/media/Backup/daily_backup/ ~/dev/ ~/.mail/ ~/Nextcloud/ ~/org/ /media/backup/personal/Pictures/ /media/backup/personal/Libros/ /media/backup/personal/dev/ /media/backup/Archives/ -backup_local Admin/sarah/borg/ingrid ssh://borgbackup@najera.pw/./repos/ingrid ~/dev/ ~/org/ ~/.mail/ ~/Nextcloud/ -backup_local Admin/sarah/borg/oscar ssh://borgbackup@najera.pw/./repos/oscar /media/backup/personal/Pictures/ /media/backup/personal/Libros/ /media/backup/personal/dev/ /media/backup/Archives/ diff --git a/.local/bin/tagmail.sh b/.local/bin/tagmail.sh deleted file mode 100755 index ea3616b..0000000 --- a/.local/bin/tagmail.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then - source /tmp/.Xdbus -fi - -# delete mail -notmuch search --output=files tag:deleted | xargs -I {} rm -v "{}" - -# Mail download -if [ -z "$1" ] -then - echo "syncing all mailboxes" - mbsync -a -else - echo "syncing $1 mailbox" - mbsync "$1" -fi - -# Notmuch tagging -notmuch new - -notmuch tag +ci -new -- from:travis-ci.com or from:travis-ci.org or from:appveyor.com or from:circleci.com -notmuch tag +ci -new -- from:mg.gitlab.com and subject:Pipeline -notmuch tag +CMK-JIRA -inbox -new -- from:infra@mathias-kettner.de or from:jira@tribe29.com -notmuch tag +alle-mk -new -- to:alle@mathias-kettner.de to:technik@tribe29.com -notmuch tag +cmk-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmk\] -notmuch tag +mkde-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[mkde\] -notmuch tag +cmc-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmc\] -notmuch tag +cma-commits -new -- to:cma-commits@mathias-kettner.de and subject:\[cma\] -notmuch tag +immonews -new -- from:immobilienscout24.de -notmuch tag +immonews/communications -new -- from:nachrichten.immobilienscout24.de or subject:Kontaktaufnahme and tag:immonews -notmuch tag +socialnews -new -- from:facebookmail.com or from:mail.instagram.com -notmuch tag +linkedin +socialnews -new -- from:linkedin.com -notmuch tag +promotions -- from:newsletter -notmuch tag +toastmasters -- toastmaster NOT from:info@meetup.com - -notmuch tag +sms -inbox -- folder:hi_pers/SMS -notmuch tag +calls -inbox -- folder:hi_pers/Calls - -# afew tagging -afew --tag --new -v - -notmuch tag -inbox -- tag:lists diff --git a/bin/backup.sh b/bin/backup.sh new file mode 100755 index 0000000..74cc02c --- /dev/null +++ b/bin/backup.sh @@ -0,0 +1,36 @@ +#! /bin/bash + +backup_local(){ + # external program to supply the passphrase: + export BORG_PASSCOMMAND="pass show $1" # repo pass first arg + + # Create Local Backups + echo $( date ) "Creating Local Backups ..." + REPOSITORY=$2 # repo vault path second arg + shift 2 # consume the first 2 arguments + borg create --list --filter AME --stats --compression=lz4 \ + --progress --exclude '*.pyc' \ + --exclude '*/.mypy_cache/' \ + --exclude '*/.notmuch' \ + --exclude '*/node_modules' \ + --exclude '*/js/compiled' \ + --exclude '*/mpd/log' \ + --exclude '*/venv/' \ + --exclude '*/.tox/' \ + --exclude '*.elc' \ + $REPOSITORY::'{hostname}-{user}-{utcnow:%Y-%m-%dT%H:%M:%S}' \ + $@ # all the dirs to bac + + # Prune Local Backups + echo $( date ) "Pruning local repository ..." + + borg prune --verbose --stats --list \ + --prefix='{hostname}-{user}-' \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 $REPOSITORY +} + +backup_local borgbackup ssh://backup/media/Backup/daily_backup/ ~/dev/ ~/.mail/ ~/Nextcloud/ ~/org/ /media/backup/personal/Pictures/ /media/backup/personal/Libros/ /media/backup/personal/dev/ /media/backup/Archives/ +backup_local Admin/sarah/borg/ingrid ssh://borgbackup@173.212.211.30/./repos/ingrid ~/dev/ ~/org/ ~/.mail/ ~/Nextcloud/ +backup_local Admin/sarah/borg/oscar ssh://borgbackup@173.212.211.30/./repos/oscar /media/backup/personal/Pictures/ /media/backup/personal/Libros/ /media/backup/personal/dev/ /media/backup/Archives/ diff --git a/bin/tagmail.sh b/bin/tagmail.sh new file mode 100755 index 0000000..b08b005 --- /dev/null +++ b/bin/tagmail.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then + source /tmp/.Xdbus +fi + +# delete mail +notmuch search --output=files tag:deleted | xargs -I {} rm -v "{}" + +# Mail download +if [ -z "$1" ] +then + echo "syncing all mailboxes" + mbsync -a +else + echo "syncing $1 mailbox" + mbsync "$1" +fi + +# Notmuch tagging +notmuch new + +notmuch tag +ci -new -- from:travis-ci.com or from:travis-ci.org or from:appveyor.com or from:circleci.com +notmuch tag +ci -new -- from:mg.gitlab.com and subject:Pipeline +notmuch tag +CMK-JIRA -inbox -new -- from:infra@mathias-kettner.de or from:jira@tribe29.com +notmuch tag +alle-mk -new -- to:alle@mathias-kettner.de to:technik@tribe29.com +notmuch tag +cmk-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmk\] +notmuch tag +mkde-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[mkde\] +notmuch tag +cmc-commits -new -- to:cmk-internal-commits@mathias-kettner.de and subject:\[cmc\] +notmuch tag +cma-commits -new -- to:cma-commits@mathias-kettner.de and subject:\[cma\] +notmuch tag +immonews -new -- from:immobilienscout24.de +notmuch tag +immonews/communications -new -- from:nachrichten.immobilienscout24.de or subject:Kontaktaufnahme and tag:immonews +notmuch tag +socialnews -new -- from:facebookmail.com or from:mail.instagram.com +notmuch tag +linkedin +socialnews -new -- from:linkedin.com +notmuch tag +promotions -- from:newsletter +notmuch tag +toastmasters -- toastmaster NOT from:info@meetup.com + +notmuch tag +sms -new -- folder:hi_pers/SMS +notmuch tag +calls -new -- folder:hi_pers/Calls + +# afew tagging +afew --tag --new -v + +notmuch tag -inbox -- tag:lists diff --git a/install.scm b/install.scm index 5cdef9b..8e1d914 100755 --- a/install.scm +++ b/install.scm @@ -4,6 +4,7 @@ (use-modules (ice-9 popen) (logging logger) (logging port-log) + (ice-9 ftw) (oop goops) (term ansi-color)) @@ -66,6 +67,14 @@ (config-links " Symlink global config" "git/global-gitconfig" "~/.gitconfig") (config-links " Symlink Tribe29 config" "git/tribe29" "~/git/.gitconfig")) +(define (symlink-dir dir target-dir) + (let ((cur (getcwd))) + (chdir dir) + (map (lambda (cmd) + (config-links (string-append " Symlink " cmd) cmd (string-append target-dir cmd))) + (scandir "." (lambda (f) (eq? 'regular (stat:type (stat f)))))) + (chdir cur))) + (define (main args) (setup-logging) (log-msg 'INFO "Symlink PIM") @@ -74,5 +83,6 @@ (config-links " Symlink guile defaults" "dot-guile" "~/.guile") (config-links " Symlink rofi" "rofi" "~/.config/rofi") (config-links " Symlink zshrc" "dot-zshrc" "~/.zshrc") + (symlink-dir "bin" "~/.local/bin/") (shutdown-logging)) -- cgit v1.2.3