From 02a2196150b16ee1c343a5587cadb177016fe222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 15 Oct 2016 19:22:44 +0200 Subject: Update files to changes done while abandoning systemd Now I use openrc. --- .gitmodules | 3 --- config/i3/config | 9 +++---- config/i3blocks/config | 9 ++----- config/systemd/user/syncemail.service | 10 -------- external/annoyme | 1 - install | 9 ++++--- local/bin/mxrandr | 6 ++--- local/bin/startme | 7 ----- local/bin/sys-reboot | 2 ++ local/bin/sys-shutdown | 2 ++ local/bin/sys-suspend | 2 ++ local/bin/system-backup | 7 +++-- local/sbin/syncemail | 48 ++++++++++++++++------------------- private | 2 +- profile | 6 +++++ xinitrc | 3 ++- zprofile | 3 +++ 17 files changed, 57 insertions(+), 72 deletions(-) delete mode 100644 config/systemd/user/syncemail.service delete mode 160000 external/annoyme delete mode 100755 local/bin/startme create mode 100755 local/bin/sys-reboot create mode 100755 local/bin/sys-shutdown create mode 100755 local/bin/sys-suspend create mode 100644 profile create mode 100644 zprofile diff --git a/.gitmodules b/.gitmodules index a02eb04..3a6f663 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,6 +37,3 @@ [submodule "vim/bundle/vim-autotag"] path = vim/bundle/vim-autotag url = https://github.com/craigemery/vim-autotag.git -[submodule "external/annoyme"] - path = external/annoyme - url = git@cynerd.cz:annoyme diff --git a/config/i3/config b/config/i3/config index a3340aa..13bcde4 100644 --- a/config/i3/config +++ b/config/i3/config @@ -137,14 +137,13 @@ bindsym $mod+Shift+r restart set $Locker i3lock -d -c 000000 && sleep 1 -set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +set $mode_system System (l) lock, (e) logout, (s) suspend, (r) reboot, (Shift+s) shutdown mode "$mode_system" { bindsym l exec --no-startup-id $Locker, mode "default" bindsym e exec --no-startup-id i3-msg exit, mode "default" - bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default" - bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default" - bindsym r exec --no-startup-id systemctl reboot, mode "default" - bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" + bindsym s exec --no-startup-id sys-suspend, mode "default" + bindsym r exec --no-startup-id sys-reboot, mode "default" + bindsym Shift+s exec --no-startup-id sys-shutdown, mode "default" # back to normal: Enter or Escape bindsym Return mode "default" diff --git a/config/i3blocks/config b/config/i3blocks/config index 75fffba..aee4139 100644 --- a/config/i3blocks/config +++ b/config/i3blocks/config @@ -62,7 +62,7 @@ signal=10 # see the script for details. [cpu_usage] #label=CPU -label= +label=cpu interval=10 separator=false @@ -71,7 +71,7 @@ separator=false # The type defaults to "mem" if the instance is not specified. [memory] #label=MEM -label= +label=mem interval=30 [bbswitch] @@ -95,11 +95,6 @@ instance=/ interval=30 separator=false [disk] -label=/home -instance=/home -interval=30 -separator=false -[disk] label=/home_hdd instance=/home_hdd interval=30 diff --git a/config/systemd/user/syncemail.service b/config/systemd/user/syncemail.service deleted file mode 100644 index 1940f46..0000000 --- a/config/systemd/user/syncemail.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Email synchronization - -[Service] -ExecStart=/home/cynerd/.local/sbin/syncemail -KillSignal=SIGUSR2 -Restart=always - -[Install] -WantedBy=default.target diff --git a/external/annoyme b/external/annoyme deleted file mode 160000 index bc899e8..0000000 --- a/external/annoyme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc899e872b336db938f525b1aa889e034cde4c45 diff --git a/install b/install index 5335f86..a9d990e 100755 --- a/install +++ b/install @@ -15,12 +15,14 @@ read -p "Install Bashrc? (Y/n) " if [[ $REPLY =~ ^[Yy]?$ ]]; then inst bashrc ~/.bashrc inst shellrc ~/.shellrc + inst profile ~/.profile fi read -p "Install zshrc? (Y/n) " if [[ $REPLY =~ ^[Yy]?$ ]]; then inst zshrc ~/.zshrc inst shellrc ~/.shellrc + inst zprofile ~/.zprofile fi read -p "Install GIT configuration? (Y/n) " @@ -41,9 +43,6 @@ fi read -p "Install email synchronization? (Y/n) " if [[ $REPLY =~ ^[Yy]?$ ]]; then - inst external/annoyme/src/annoyme ~/.local/bin/ - inst external/annoyme/src/annoyme-request ~/.local/sbin/ - inst config/systemd/user/syncemail.service ~/.config/systemd/user inst_email_sync # Contains: # inst local/sbin/syncemail ~/.local/sbin/ @@ -71,7 +70,9 @@ if [[ $REPLY =~ ^[Yy]?$ ]]; then inst config/i3status/ ~/.config/i3status inst config/dunst/ ~/.config/dunst inst local/bin/mxrandr ~/.local/bin/ - inst local/bin/startme ~/.local/bin/ + inst local/bin/sys-reboot ~/.local/bin/ + inst local/bin/sys-shutdown ~/.local/bin/ + inst local/bin/sys-suspend ~/.local/bin/ fi read -p "Install Conkeror configuration? (Y/n) " 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() diff --git a/private b/private index 69381d4..46aaf1f 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 69381d40d857c4ccf03bf7e78767509ef0399923 +Subproject commit 46aaf1f524abcecf87471bc1a6aafdbfaa1ef024 diff --git a/profile b/profile new file mode 100644 index 0000000..8a59d6e --- /dev/null +++ b/profile @@ -0,0 +1,6 @@ +# Start pulse audio +pulseaudio --start +# Start music player daemon +mpd ~/.config/mpd/mpd.conf +# Start email synchronization +~/.local/sbin/syncemail diff --git a/xinitrc b/xinitrc index 64cd19b..e84916f 100644 --- a/xinitrc +++ b/xinitrc @@ -5,7 +5,8 @@ export QT_STYLE_OVERRIDE='gtk2' export STEAM_RUNTIME=0 mxrandr +start-pulseaudio-x11 #exec i3 -d all -V >> ~/i3log-$(date +'%F-%k-%M-%S') 2>&1 -exec i3 +exec ck-launch-session dbus-launch --sh-syntax --exit-with-session i3 #exec i3 --shmlog-size=26214400 diff --git a/zprofile b/zprofile new file mode 100644 index 0000000..5654659 --- /dev/null +++ b/zprofile @@ -0,0 +1,3 @@ +emulate sh +. ~/.profile +emulate zsh -- cgit v1.2.3