aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2015-07-02 09:38:54 +0200
committerDuncaen <mail@duncano.de>2015-07-02 09:38:54 +0200
commit3694014ac8ce76023c06c69b562a7addf69aa355 (patch)
tree4748bdeb045e9712a8f0d7503e40612ea5516010
parentaf363d10381831bef8ac3f24ab86e3243a9493b1 (diff)
downloaddotfiles-3694014ac8ce76023c06c69b562a7addf69aa355.tar.gz
move z to my fork
-rw-r--r--.gitmodules2
-rwxr-xr-xbin/s61
-rwxr-xr-xbin/venv11
-rw-r--r--notes.md1
-rw-r--r--profile6
l---------service/x2
-rwxr-xr-xsv/syncthing/run2
-rw-r--r--vimrc1
-rw-r--r--xinitrc2
m---------z0
10 files changed, 74 insertions, 14 deletions
diff --git a/.gitmodules b/.gitmodules
index 7409139..482b800 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "z"]
path = z
- url = git@github.com:rupa/z.git
+ url = git@github.com:duncaen/z.git
diff --git a/bin/s b/bin/s
index a109f6c..7f2d2bf 100755
--- a/bin/s
+++ b/bin/s
@@ -1,23 +1,23 @@
#!/usr/bin/mksh
fatal() {
- msg "FATAL: $1"
+ msg "$@" >&2
exit 1
}
msg() {
- printf "$1\n"
+ printf "$@"
}
sv_enable() {
- [ ! -e "${SVDIR}${1}" ] && fatal "service '${1}' not found."
- [ -e "${SERVICEDIR}${1}" ] && fatal "service '${1}' already enabled."
+ [ ! -e "${SVDIR}${1}" ] && fatal "service '${1}' not found.\n"
+ [ -e "${SERVICEDIR}${1}" ] && fatal "service '${1}' already enabled.\n"
ln -sfv "${SVDIR}${1}" "${SERVICEDIR}${1}"
}
sv_disable() {
[ ! -e "${SVDIR}${1}" ] && fatal "service '${1}' not found."
- [ ! -e "${SERVICEDIR}${1}" ] && fatal "service '${1}' already disabled."
+ [ ! -e "${SERVICEDIR}${1}" ] && fatal "service '${1}' already disabled.\n"
rm -rfv "${SERVICEDIR}${1}"
}
@@ -25,9 +25,56 @@ sv_list() {
sv s "${SERVICEDIR}"*
}
-while getopts "u:v" opt; do
+sv_deps() {
+ for service in "$@"; do
+ # TODO: check if service exists
+ case $(cat "${SVDIR}${service}/supervise/stat") in
+ run*)
+ /home/duncan/bin/s check "${service}" >/dev/null || wait+=" $service"
+ ;;
+ down*)
+ /home/duncan/bin/s u "${service}" >/dev/null && wait+=" $service"
+ ;;
+ esac
+ done
+ [ -z "$wait" ] || fatal "wait for dependencies:$wait.\n"
+ exit 0
+}
+
+sv_tree() {
+ services=$(ls -1 "$1" 2>/dev/null)
+ [ "$?" -ne "0" ] && return 1
+
+ set -A tree
+
+ for f in ${services}; do
+ for b in $(ls -1 "${SVDIR}${f}/before" 2> /dev/null); do
+ echo "$b>$f"
+ before="$before$b:$f\n"
+ done
+ for a in $(ls -1 "${SVDIR}${f}/after" 2> /dev/null); do
+ echo "$f<$a"
+ after="$after$a:$f\n"
+ done
+ done
+
+ for f in ${services}; do
+ echo "$f;"
+ for a in $(echo "$after" | grep "$f"'$'); do
+ echo "$f--$a"
+ after=$(echo "$after" | sed 's/^://g')
+ done
+ done
+
+ echo "before:\n$before"
+ echo "after:\n$after"
+
+}
+
+while getopts "u:w:v" opt; do
case "$opt" in
u) SVUSER="$OPTARG" ;;
+ w) export SVWAIT="$OPTARG" ;;
esac
done
shift $(($OPTIND - 1))
@@ -50,5 +97,7 @@ case "$1" in
ls|list) sv_list "$2" ;;
enable) sv_enable "$2" ;;
disable) sv_disable "$2" ;;
+ deps) shift 1; sv_deps "$@" ;;
+ tree) shift 1; sv_tree "$SVDIR" ;;
*) SVDIR="$SVDIR" sv "$@" ;;
esac
diff --git a/bin/venv b/bin/venv
index 7a76d41..6722254 100755
--- a/bin/venv
+++ b/bin/venv
@@ -2,11 +2,15 @@
readonly PROGNAME=$(basename $0)
+function venv_list {
+ ls -l "$VENV_PATH"
+}
+
function venv_create {
- if [[ ! -d $VENV_PATH/$1 ]]; then
- mkdir -pv $VENV_PATH/$1
+ if [[ ! -d "$VENV_PATH/$1" ]]; then
+ mkdir -pv "$VENV_PATH/$1"
fi
- ${VENV_CMD} $VENV_PATH/$1
+ ${VENV_CMD} "$VENV_PATH/$1"
}
function venv_delete {
@@ -65,6 +69,7 @@ if [ -r ${CONFIG_FILE} ]; then
fi
case "$1" in
+ l*) venv_list $2;;
cr*) venv_create $2;;
del*) venv_delete $2;;
ac*) venv_activate $2;;
diff --git a/notes.md b/notes.md
index 0cc9120..51390e8 100644
--- a/notes.md
+++ b/notes.md
@@ -1,6 +1,7 @@
# Terminal
`CTRL+s` `CTRL+q` Pause/resume output
+`CTRL+i` complete file
## dvtm
diff --git a/profile b/profile
index 0a8d1f0..2e2f10b 100644
--- a/profile
+++ b/profile
@@ -1,4 +1,8 @@
# load system profile
. /etc/profile
# Keychain
-[ -r /usr/bin/keychain ] && eval `keychain --eval --agents ssh id_rsa`
+#[ -r /usr/bin/keychain ] && eval `keychain --eval --agents ssh id_rsa`
+
+# runsvdir ~/service
+export DISPLAY=:0
+export XAUTHORITY=~/.Xauthority
diff --git a/service/x b/service/x
index 54ac6c2..cfe1dea 120000
--- a/service/x
+++ b/service/x
@@ -1 +1 @@
-../sv/x \ No newline at end of file
+/home/duncan/sv/x \ No newline at end of file
diff --git a/sv/syncthing/run b/sv/syncthing/run
index 889a641..c23377e 100755
--- a/sv/syncthing/run
+++ b/sv/syncthing/run
@@ -1,4 +1,4 @@
#!/bin/mksh
exec 2>&1
-exec syncthing -logflags 0
+exec syncthing -logflags 0 -no-restart
diff --git a/vimrc b/vimrc
index dfee90a..d578d17 100644
--- a/vimrc
+++ b/vimrc
@@ -19,6 +19,7 @@ Plug 'Lokaltog/vim-easymotion'
Plug 'bling/vim-airline'
Plug 'majutsushi/tagbar'
endif
+Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
Plug 'kien/ctrlp.vim'
Plug 'bling/vim-bufferline'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
diff --git a/xinitrc b/xinitrc
index d63ad9c..2c519de 100644
--- a/xinitrc
+++ b/xinitrc
@@ -33,4 +33,4 @@ repos/go-dwmstatus/go-dwmstatus &
while true; do
dwm >/dev/null 2>&1
done
-#exec dwm
+# exec dwm
diff --git a/z b/z
-Subproject d5adc9a6239c2ee44309fd78bca68f301eb0d45
+Subproject 99a09a93e44d436cd3756bfa763ae50966a3a7b