diff options
-rwxr-xr-x | s6-db-update | 52 | ||||
-rwxr-xr-x | s6-user-update | 52 |
2 files changed, 52 insertions, 52 deletions
diff --git a/s6-db-update b/s6-db-update index 5359b5d..0b55077 100755 --- a/s6-db-update +++ b/s6-db-update @@ -1,31 +1,31 @@ - #!/bin/sh +#!/bin/sh - DATAPATH="/home/${USER}/.local/share/s6" - RCPATH="${DATAPATH}/rc" - DBPATH="${RCPATH}/compiled" - SVPATH="${DATAPATH}/sv" - SVDIRS="/run/${USER}/s6-rc/servicedirs" - TIMESTAMP=$(date +%s) +DATAPATH="/home/${USER}/.local/share/s6" +RCPATH="${DATAPATH}/rc" +DBPATH="${RCPATH}/compiled" +SVPATH="${DATAPATH}/sv" +SVDIRS="/run/${USER}/s6-rc/servicedirs" +TIMESTAMP=$(date +%s) - if ! s6-rc-compile "${DBPATH}"-"${TIMESTAMP}" "${SVPATH}"; then - echo "Error compiling database. Please double check the ${SVPATH} directories." - exit 1 - fi +if ! s6-rc-compile "${DBPATH}"-"${TIMESTAMP}" "${SVPATH}"; then + echo "Error compiling database. Please double check the ${SVPATH} directories." + exit 1 +fi - if [ -e "/run/${USER}/s6-rc" ]; then - for dir in "${SVDIRS}"/*; do - if [ -e "${dir}/down" ]; then - s6-svc -x "${dir}" - fi - done - s6-rc-update -l "/run/${USER}/s6-rc" "${DBPATH}"-"${TIMESTAMP}" - fi +if [ -e "/run/${USER}/s6-rc" ]; then + for dir in "${SVDIRS}"/*; do + if [ -e "${dir}/down" ]; then + s6-svc -x "${dir}" + fi + done + s6-rc-update -l "/run/${USER}/s6-rc" "${DBPATH}"-"${TIMESTAMP}" +fi - if [ -d "${DBPATH}" ]; then - ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}"/compiled && mv -f "${DBPATH}"/compiled "${RCPATH}" - else - ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}" - fi +if [ -d "${DBPATH}" ]; then + ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}"/compiled && mv -f "${DBPATH}"/compiled "${RCPATH}" +else + ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}" +fi - echo "==> Switched to a new database for ${USER}." - echo " Remove any old unwanted/unneeded database directories in ${RCPATH}." +echo "==> Switched to a new database for ${USER}." +echo " Remove any old unwanted/unneeded database directories in ${RCPATH}." diff --git a/s6-user-update b/s6-user-update index 5359b5d..0b55077 100755 --- a/s6-user-update +++ b/s6-user-update @@ -1,31 +1,31 @@ - #!/bin/sh +#!/bin/sh - DATAPATH="/home/${USER}/.local/share/s6" - RCPATH="${DATAPATH}/rc" - DBPATH="${RCPATH}/compiled" - SVPATH="${DATAPATH}/sv" - SVDIRS="/run/${USER}/s6-rc/servicedirs" - TIMESTAMP=$(date +%s) +DATAPATH="/home/${USER}/.local/share/s6" +RCPATH="${DATAPATH}/rc" +DBPATH="${RCPATH}/compiled" +SVPATH="${DATAPATH}/sv" +SVDIRS="/run/${USER}/s6-rc/servicedirs" +TIMESTAMP=$(date +%s) - if ! s6-rc-compile "${DBPATH}"-"${TIMESTAMP}" "${SVPATH}"; then - echo "Error compiling database. Please double check the ${SVPATH} directories." - exit 1 - fi +if ! s6-rc-compile "${DBPATH}"-"${TIMESTAMP}" "${SVPATH}"; then + echo "Error compiling database. Please double check the ${SVPATH} directories." + exit 1 +fi - if [ -e "/run/${USER}/s6-rc" ]; then - for dir in "${SVDIRS}"/*; do - if [ -e "${dir}/down" ]; then - s6-svc -x "${dir}" - fi - done - s6-rc-update -l "/run/${USER}/s6-rc" "${DBPATH}"-"${TIMESTAMP}" - fi +if [ -e "/run/${USER}/s6-rc" ]; then + for dir in "${SVDIRS}"/*; do + if [ -e "${dir}/down" ]; then + s6-svc -x "${dir}" + fi + done + s6-rc-update -l "/run/${USER}/s6-rc" "${DBPATH}"-"${TIMESTAMP}" +fi - if [ -d "${DBPATH}" ]; then - ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}"/compiled && mv -f "${DBPATH}"/compiled "${RCPATH}" - else - ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}" - fi +if [ -d "${DBPATH}" ]; then + ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}"/compiled && mv -f "${DBPATH}"/compiled "${RCPATH}" +else + ln -sf "${DBPATH}"-"${TIMESTAMP}" "${DBPATH}" +fi - echo "==> Switched to a new database for ${USER}." - echo " Remove any old unwanted/unneeded database directories in ${RCPATH}." +echo "==> Switched to a new database for ${USER}." +echo " Remove any old unwanted/unneeded database directories in ${RCPATH}." |