Add new install-home.sh
This commit is contained in:
parent
2a0e0b81bc
commit
c2897c1610
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
: ${DOTFILES_HOME:=$HOME/git/dotfiles}
|
||||||
|
|
||||||
|
: ${XDG_CACHE_HOME:=$HOME/.cache}
|
||||||
|
: ${XDG_CONFIG_HOME:=$HOME/.config}
|
||||||
|
: ${XDG_DATA_HOME:=$HOME/.data}
|
||||||
|
|
||||||
|
: ${BIN_HOME:=$HOME/.local/bin}
|
||||||
|
: ${SV_HOME:=$HOME/.config/sv}
|
||||||
|
: ${SVDIR:=$HOME/sv}
|
||||||
|
|
||||||
|
cat <<! >&2
|
||||||
|
XDG_CACHE_HOME = ${XDG_CACHE_HOME}
|
||||||
|
XDG_CONFIG_HOME = ${XDG_CONFIG_HOME}
|
||||||
|
XDG_DATA_HOME = ${XDG_DATA_HOME}
|
||||||
|
BIN_HOME = ${BIN_HOME}
|
||||||
|
SV_HOME = ${SV_HOME}
|
||||||
|
SVDIR = ${SVDIR}
|
||||||
|
|
||||||
|
!
|
||||||
|
|
||||||
|
# symlinks
|
||||||
|
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/.cache "${XDG_CACHE_HOME}"
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/.config "${XDG_CONFIG_HOME}"
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/.data "${XDG_DATA_HOME}"
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/.bin "${BIN_HOME}"
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/.config/sv "${SV_HOME}"
|
||||||
|
ln -sfn "${DOTFILES_HOME}"/sv "${SVDIR}"
|
||||||
|
|
||||||
|
# environment
|
||||||
|
|
||||||
|
echo "${HOME}" >"${XDG_DATA_HOME}"/env/HOME
|
||||||
|
echo "${XDG_CACHE_HOME}" >"${XDG_DATA_HOME}"/env/XDG_CACHE_HOME
|
||||||
|
echo "${XDG_CONFIG_HOME}" >"${XDG_DATA_HOME}"/env/XDG_CONFIG_HOME
|
||||||
|
echo "${XDG_DATA_HOME}" >"${XDG_DATA_HOME}"/env/XDG_DATA_HOME
|
||||||
|
echo "${SVDIR}" >"${SVDIR}"/env/SVDIR
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
# drop available services in ~/.config/sv
|
# drop available services in ~/.config/sv
|
||||||
# and link to ~/sv to enable them
|
# and link to ~/sv to enable them
|
||||||
|
|
||||||
user=
|
zuser=
|
||||||
|
[ -z "$zuser" ] && echo "User is not set, please edit the script accordingly." && exit 1
|
||||||
|
|
||||||
install -d /etc/sv/runsvdir-$user
|
install -d /etc/sv/runsvdir-$zuser
|
||||||
install -m755 sv/runsvdir/run /etc/sv/runsvdir-$user/run
|
install -m755 sv/runsvdir/run /etc/sv/runsvdir-$zuser/run
|
||||||
sed -i -e "s/\@USER\@/$user/g" /etc/sv/runsvdir-$user/run
|
sed -i -e "s/\@USER\@/$zuser/g" /etc/sv/runsvdir-$zuser/run
|
||||||
install -m755 sv/runsvdir/finish /etc/sv/runsvdir-$user/finish
|
install -m755 sv/runsvdir/finish /etc/sv/runsvdir-$zuser/finish
|
||||||
sed -i -e "s/\@USER\@/$user/g" /etc/sv/runsvdir-$user/finish
|
sed -i -e "s/\@USER\@/$zuser/g" /etc/sv/runsvdir-$zuser/finish
|
||||||
ln -sf /run/runit/supervise.runsvdir-$user /etc/sv/runsvdir-$user/supervise
|
ln -sf /run/runit/supervise.runsvdir-$zuser /etc/sv/runsvdir-$zuser/supervise
|
||||||
|
|
Loading…
Reference in New Issue