Add new install-home.sh

This commit is contained in:
fanyx 2023-05-23 10:03:44 +02:00
parent 2a0e0b81bc
commit c2897c1610
2 changed files with 47 additions and 7 deletions

39
void-install/install-home.sh Executable file
View File

@ -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

View File

@ -4,11 +4,12 @@
# drop available services in ~/.config/sv
# 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 -m755 sv/runsvdir/run /etc/sv/runsvdir-$user/run
sed -i -e "s/\@USER\@/$user/g" /etc/sv/runsvdir-$user/run
install -m755 sv/runsvdir/finish /etc/sv/runsvdir-$user/finish
sed -i -e "s/\@USER\@/$user/g" /etc/sv/runsvdir-$user/finish
ln -sf /run/runit/supervise.runsvdir-$user /etc/sv/runsvdir-$user/supervise
install -d /etc/sv/runsvdir-$zuser
install -m755 sv/runsvdir/run /etc/sv/runsvdir-$zuser/run
sed -i -e "s/\@USER\@/$zuser/g" /etc/sv/runsvdir-$zuser/run
install -m755 sv/runsvdir/finish /etc/sv/runsvdir-$zuser/finish
sed -i -e "s/\@USER\@/$zuser/g" /etc/sv/runsvdir-$zuser/finish
ln -sf /run/runit/supervise.runsvdir-$zuser /etc/sv/runsvdir-$zuser/supervise