aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/mxrandr6
-rwxr-xr-xlocal/bin/startme7
-rwxr-xr-xlocal/bin/sys-reboot2
-rwxr-xr-xlocal/bin/sys-shutdown2
-rwxr-xr-xlocal/bin/sys-suspend2
-rwxr-xr-xlocal/bin/system-backup7
-rwxr-xr-xlocal/sbin/syncemail48
7 files changed, 34 insertions, 40 deletions
diff --git a/local/bin/mxrandr b/local/bin/mxrandr
index 81ae511..7c51128 100755
--- a/local/bin/mxrandr
+++ b/local/bin/mxrandr
@@ -8,9 +8,9 @@ disconnectedOutputs=$(xrandr | grep -E " disconnected (primary )?[1-9]+" | awk '
cmd="xrandr "
cmd_def=$cmd
-INTERNAL=eDP-1
-HDMI=HDMI-1
-VGA=VGA-1
+INTERNAL=eDP1
+HDMI=HDMI1
+VGA=VGA1
for device in "$disconnectedOutputs"; do
if [ -n "$defice" ]; then
diff --git a/local/bin/startme b/local/bin/startme
deleted file mode 100755
index 4af6150..0000000
--- a/local/bin/startme
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-if ls ~/.annoyme/*.pid 2>/dev/null >/dev/null; then
- annoyme
-fi
-
-startx
diff --git a/local/bin/sys-reboot b/local/bin/sys-reboot
new file mode 100755
index 0000000..24a024c
--- /dev/null
+++ b/local/bin/sys-reboot
@@ -0,0 +1,2 @@
+#!/bin/sh
+dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
diff --git a/local/bin/sys-shutdown b/local/bin/sys-shutdown
new file mode 100755
index 0000000..bff9762
--- /dev/null
+++ b/local/bin/sys-shutdown
@@ -0,0 +1,2 @@
+#!/bin/sh
+dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
diff --git a/local/bin/sys-suspend b/local/bin/sys-suspend
new file mode 100755
index 0000000..49b4b2e
--- /dev/null
+++ b/local/bin/sys-suspend
@@ -0,0 +1,2 @@
+#!/bin/sh
+dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend boolean:true
diff --git a/local/bin/system-backup b/local/bin/system-backup
index e19889d..956ba31 100755
--- a/local/bin/system-backup
+++ b/local/bin/system-backup
@@ -1,11 +1,9 @@
#!/bin/bash
# vim:ft=sh
# New line separated list of all directories to backup
-read -d '' DIRS <<-"_EOF_"
-/etc
+DIRS="/etc
/home
-/home_hdd
-_EOF_
+/home_hdd"
# Path where backup will be mounted
MPATH=/media/backup-hdd
# UUID of disk
@@ -18,6 +16,7 @@ if [ `id -u` -ne "0" ]; then
echo Please run this as root.
exit 1
fi
+set -e
# Mount disk
PART=$(lsblk -fpl | grep "$UUID" | awk '{print $1}')
diff --git a/local/sbin/syncemail b/local/sbin/syncemail
index 95deb7e..d0ea682 100755
--- a/local/sbin/syncemail
+++ b/local/sbin/syncemail
@@ -1,36 +1,32 @@
#!/usr/bin/python2
-# This starts offlineimap, but first it requests passwords from pass by user
-# notification launching script at front.
+# This starts offlineimap, but first it requests passwords from pass
import os
import sys
import subprocess
+import daemon
+import lockfile
from offlineimap import OfflineImap
-frontscript = """
-echo "Asking for gpg password to access pass" 1>&2
-pass mail/cynerd@email.cz
-echo "All done" 1>&2
-"""
-annoyme = [
- os.path.expanduser("~/.local/sbin/annoyme-request"),
- "syncemail",
- "Imap email synchronization service password request."
- ]
+if os.path.isfile('/home/cynerd/.run/syncemail.pid.lock'):
+ sys.exit(0)
-anproc = subprocess.Popen(annoyme, stdin=subprocess.PIPE,
- stdout=subprocess.PIPE)
-anproc.stdin.write(frontscript)
-anproc.stdin.close()
-output = anproc.stdout.read().splitlines()
-excode = anproc.wait()
+accounts = [
+ ["email", "mail/cynerd@email.cz"],
+ ]
-if excode != 0:
- print("Authentication failed. Please start emailsync again")
- sys.exit(1)
-print(output)
+for acc in accounts:
+ pproc = subprocess.Popen("pass " + acc[1],
+ stdout=subprocess.PIPE, shell=True)
+ output = pproc.stdout.read().rstrip()
+ if pproc.wait() != 0:
+ print("Password receive failed.")
+ sys.exit(1)
+ sys.argv.append('-k')
+ sys.argv.append('Repository_' + acc[0] + '-remote:remotepass=' + output)
-sys.argv.append('-k')
-sys.argv.append('Repository_email-remote:remotepass=' + output[0])
+sys.argv.append('-s') # output to syslog
-
-OfflineImap().run()
+with daemon.DaemonContext(
+ pidfile=lockfile.FileLock('/home/cynerd/.run/syncemail.pid')
+ ):
+ OfflineImap().run()