From 1b78d7734db35ed8b7651794690b90ff21f01472 Mon Sep 17 00:00:00 2001 From: Taeyeon Mori Date: Sun, 5 Nov 2017 22:48:54 +0900 Subject: [PATCH] systemd: Revamp systemd unit installation Shipping the wanted symlinks didn't seem to work right and probably isn't the right approach either. Instead, call into systemctl from install.extra May have to manually delete old wanted links and re-run install --- .../default.target.wants/ssh-agent.service | 1 - config/systemd/user/ssh-agent.service | 4 +-- install | 26 ++++++++++++++++--- install.extra | 5 ++++ 4 files changed, 29 insertions(+), 7 deletions(-) delete mode 120000 config/systemd/user/default.target.wants/ssh-agent.service create mode 100755 install.extra diff --git a/config/systemd/user/default.target.wants/ssh-agent.service b/config/systemd/user/default.target.wants/ssh-agent.service deleted file mode 120000 index fbfd099..0000000 --- a/config/systemd/user/default.target.wants/ssh-agent.service +++ /dev/null @@ -1 +0,0 @@ -../ssh-agent.service \ No newline at end of file diff --git a/config/systemd/user/ssh-agent.service b/config/systemd/user/ssh-agent.service index dd23fde..8d38ed7 100644 --- a/config/systemd/user/ssh-agent.service +++ b/config/systemd/user/ssh-agent.service @@ -4,9 +4,9 @@ Description=SSH publickey authentication agent [Service] Type=simple Environment=SSH_AUTH_SOCK=%t/ssh-agent.sock -ExecStart=/usr/bin/ssh-agent -D -a ${SSH_AUTH_SOCK} +ExecStart=/usr/bin/ssh-agent -D -a ${SSH_AUTH_SOCK} -t 2h ExecStartPost=/usr/bin/systemctl --user set-environment SSH_AUTH_SOCK=${SSH_AUTH_SOCK} -ExecStopPre=/usr/bin/systemctl --user unset-environment SSH_AUTH_SOCK=${SSH_AUTH_SOCK} +ExecStopPost=/usr/bin/systemctl --user unset-environment SSH_AUTH_SOCK=${SSH_AUTH_SOCK} [Install] WantedBy=default.target diff --git a/install b/install index d6cb548..083d8a1 100755 --- a/install +++ b/install @@ -1,6 +1,6 @@ #!/bin/zsh -# .files/installer -# (c) 2014 MORI Taeyeon +# .files/install +# (c) 2014-2017 MORI Taeyeon # Paths & Utils DOT="$(realpath "$(dirname "$0")")" @@ -9,7 +9,9 @@ cd "$DOT" setopt EXTENDED_GLOB source "$DOT/lib/libzsh-utils.zsh" + # Parse commandline +# ============================= OVERWRITE=false ASK=true @@ -41,7 +43,9 @@ for arg in "$@"; do done [[ -n "$STATE" ]] && err "Option $STATE is missing it's parameter!" && exit 1 + # Helper functions +# ============================= function generate() { [[ -e "$1" ]] && ! $OVERWRITE && ! grep -q "Generated by .files/install" "$1" && \ err "Custom version of $1 detected. Please delete it before running .files/install" && exit 1 @@ -58,6 +62,9 @@ function relink() { color 31 ln -s "$(relpath "$1" "$(dirname "$2")")" "$2" } + +# Prepare +# ============================= # Update git modules msg "Updating git submodules..." git submodule update --init --recursive @@ -77,12 +84,16 @@ else color 36 echo " default EMAIL=\"$EMAIL\"" fi +# Write down answers color 32 echo " Writing etc/user-info" generate "$DOT/etc/user-info" <