diff options
Diffstat (limited to 'src/usr')
-rwxr-xr-x | src/usr/bin/use-package-fluxbox-files | 56 | ||||
-rw-r--r-- | src/usr/share/man/man1/use-package-fluxbox-files.1.txt | 26 |
2 files changed, 82 insertions, 0 deletions
diff --git a/src/usr/bin/use-package-fluxbox-files b/src/usr/bin/use-package-fluxbox-files new file mode 100755 index 0000000..3d8e5f2 --- /dev/null +++ b/src/usr/bin/use-package-fluxbox-files @@ -0,0 +1,56 @@ +#!/bin/sh +# File: /usr/bin/use-package-fluxbox-files +# Location: stackrpms-acer-chromebook package +# Author: bgstack15 +# SPDX-License-Identifier: GPL-3.0 +# Startdate: 2024-04-30-3 12:46 +# Title: Use Platform Package-Provided Fluxbox Files +# Package: stackrpms-acer-chromebook +# Purpose: Symlink available package-provided fluxbox files to user fluxbox path +# History: +# Usage: +# use-package-fluxbox-files --all +# Improve: +# Dependencies: +# +# Documentation: +# Notably, this will decline to mkdir ~/.fluxbox if not present. +THIS_PACKAGE="stackrpms-acer-chromebook" + +# useful only for testing: +DESTDIR= + +# FAIL OUT IF SUDO +test -n "${SUDO_USER}" && { echo "Please run ${0} as a user, not with sudo. It makes sense only for a user. Aborted." ; exit 1 ; } + +# PARSE PARAMETERS or environment variables +# _SOFT is an additional parameter passed to ln, which uses -f to force the operation. +if test -n "${ALL}" || echo " ${*} " | grep -qE -e " --all " ; +then + _SOFT="f" +fi +# SOFT takes precedence, so calculate it last. +if test -n "${SOFT}" || echo " ${*} " | grep -qE -e " --soft " ; +then + _SOFT="" +fi +for tf in $( find "${DESTDIR}/etc/${THIS_PACKAGE}" -name 'fluxbox.*' -printf '%f\n' ) ; +do + df="$( echo "${tf}" | sed -r -e 's/^fluxbox\.//;' )" # destfile + ldf="${HOME}/.fluxbox/${df}" # long destfile + ltf="${DESTDIR}/etc/${THIS_PACKAGE}/${tf}" # long thisfile + _currentdest="$( readlink -f "${ldf}" 2>/dev/null )" + if test "${_currentdest}" = "${ltf}" ; + then + echo "${ldf} ALREADY -> ${ltf}" + else + # do not quote _SOFT: + output="$( ln -v -s${_SOFT} "${ltf}" "${ldf}" 2>&1 )" + if test $? -ne 0 ; + then + printf '%s %s\n' "${output}" "-> ${_currentdest}" + else + printf '%s%s\n' "${output}" ", WAS -> ${_currentdest}" + fi + fi +done diff --git a/src/usr/share/man/man1/use-package-fluxbox-files.1.txt b/src/usr/share/man/man1/use-package-fluxbox-files.1.txt new file mode 100644 index 0000000..a98da16 --- /dev/null +++ b/src/usr/share/man/man1/use-package-fluxbox-files.1.txt @@ -0,0 +1,26 @@ +title use-package-fluxbox-files +section 1 +project stackrpms-acer-chromebook +volume General Commands Manual +date April 2024 +===== +NAME + use-package-fluxbox-files - Use the customized fluxbox files for current user +SYNOPSIS + use-package-fluxbox-files [--all|--soft] +ENVIRONMENT VARIABLES + ALL Any non-blank value will force the symlinks. + SOFT Any non-blank value will cause the symlinks to not overwrite existing files/symlinks. Takes precedence over ALL. Default behavior. +PARAMETERS + --all Same as env var ALL. + --soft Same as env var SOFT. +DESCRIPTION + A convenience script that sets up symlinks to /etc/stackrpms-acer-chromebook/fluxbox.* files in the current user's .fluxbox/ directory. +AUTHOR + B. Stack <bgstack15@gmail.com> +COPYRIGHT + GPL 3.0 +BUGS + If you catch any bugs please email the author. +SEE ALSO + /etc/stackrpms-acer-chromebook/fluxbox.* |