+ $SYSTEM_USER ($USER) needed after all
when running this script we are root. so, we need to system user name
This commit is contained in:
@@ -8,4 +8,6 @@ OPTIONS_LOADED=true # used to check if options have been loaded
|
||||
|
||||
CLONE_TARGET_DIR=/tmp # directory to clone dots repository to
|
||||
|
||||
SYSTEM_USER=poq # system user (! root)
|
||||
|
||||
I3WM=true # {true, false} installs i3 packages
|
||||
|
||||
@@ -27,13 +27,15 @@ if [ -z "${OPTIONS_LOADED}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clone_trg=${CLONE_TARGET_DIR} # value found in options.sh file, sourced above
|
||||
# load values found in options.sh file, sourced above
|
||||
system_user=${SYSTEM_USER}
|
||||
clone_trg=${CLONE_TARGET_DIR}
|
||||
if [[ -z "${clone_trg}" ]] ; then
|
||||
echo "error: CLONE_TARGET_DIR is empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
secrets_cred_path=/home/${USER}/syncDir/secrets/toBeSources/cred.sh
|
||||
secrets_cred_path=/home/${system_user}/syncDir/secrets/toBeSources/cred.sh
|
||||
source ${secrets_cred_path}
|
||||
|
||||
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
@@ -59,7 +61,7 @@ create_dir() {
|
||||
_directory=$1
|
||||
|
||||
mkdir -p ${_directory}
|
||||
chown ${USER}:${USER} ${_directory}
|
||||
chown ${system_user}:${system_user} ${_directory}
|
||||
}
|
||||
|
||||
deploy_file() {
|
||||
@@ -94,14 +96,14 @@ deploy_file() {
|
||||
|
||||
if [[ ${_recursive} != "recursive" ]] ; then
|
||||
# https://serverfault.com/questions/156437/how-to-chown-a-directory-recursively-including-hidden-files-or-directories
|
||||
chown ${USER}:${USER} ${_trg_path}*
|
||||
chown ${USER}:${USER} ${_trg_path}.[^.]*
|
||||
chown ${system_user}:${system_user} ${_trg_path}*
|
||||
chown ${system_user}:${system_user} ${_trg_path}.[^.]*
|
||||
else
|
||||
chown -R ${USER}:${USER} ${_trg_path}*
|
||||
chown -R ${USER}:${USER} ${_trg_path}.[^.]*
|
||||
chown -R ${system_user}:${system_user} ${_trg_path}*
|
||||
chown -R ${system_user}:${system_user} ${_trg_path}.[^.]*
|
||||
fi
|
||||
else
|
||||
chown ${USER}:${USER} ${_trg_path}
|
||||
chown ${system_user}:${system_user} ${_trg_path}
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -119,7 +121,7 @@ deploy_file() {
|
||||
|
||||
# locate firefox's profile directory
|
||||
firefox_profile_dir() {
|
||||
ffdir=/home/${USER}/.mozilla/firefox/
|
||||
ffdir=/home/${system_user}/.mozilla/firefox/
|
||||
|
||||
if ! [ -d "$ffdir" ]
|
||||
then
|
||||
@@ -163,7 +165,7 @@ if [ ${operation} == "dots" ] ; then
|
||||
|
||||
# bashrc
|
||||
file_name=.bashrc
|
||||
file_path=/home/${USER}
|
||||
file_path=/home/${system_user}
|
||||
deploy_file "${dots_trg}/bash/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
# bin (executable binaries, scripts)
|
||||
@@ -249,7 +251,7 @@ if [ ${operation} == "dots" ] ; then
|
||||
|
||||
# lf
|
||||
file_name=lfrc
|
||||
file_path=/home/${USER}/.config/lf
|
||||
file_path=/home/${system_user}/.config/lf
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/lf/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
@@ -277,35 +279,35 @@ if [ ${operation} == "dots" ] ; then
|
||||
# symlink is created below. as well, ".gtkrc-2.0.mine" had no effect, so
|
||||
# ".gtkrc-2.0" is overwritten
|
||||
file_name=settings.ini
|
||||
file_path=/home/${USER}/.config/gtk-3.0
|
||||
file_path=/home/${system_user}/.config/gtk-3.0
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/gtk/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
file_name=.gtk-bookmarks
|
||||
file_path=/home/${USER}
|
||||
file_path=/home/${system_user}
|
||||
deploy_file "${dots_trg}/gtk/${file_name}" "${file_path}/${file_name}"
|
||||
tmp_file_path_full="/home/${USER}/.config/gtk-3.0/bookmarks"
|
||||
tmp_file_path_full="/home/${system_user}/.config/gtk-3.0/bookmarks"
|
||||
trash-put ${tmp_file_path_full}
|
||||
ln -s "${file_path}/${file_name}" "${tmp_file_path_full}"
|
||||
|
||||
file_name=.gtkrc-2.0
|
||||
file_path=/home/${USER}
|
||||
file_path=/home/${system_user}
|
||||
deploy_file "${dots_trg}/gtk/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
# nitrogen
|
||||
file_path=/home/${USER}/.config/nitrogen
|
||||
file_path=/home/${system_user}/.config/nitrogen
|
||||
deploy_file "${dots_trg}/nitrogen/*" "${file_path}/"
|
||||
|
||||
# pcmanfm
|
||||
# bookmarks found in "dots/gtk/.gtk-bookmarks"
|
||||
file_name=pcmanfm.conf
|
||||
file_path=/home/${USER}/.config/pcmanfm/default
|
||||
file_path=/home/${system_user}/.config/pcmanfm/default
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/pcmanfm/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
# vscodium
|
||||
file_name=settings.json
|
||||
file_path=/home/${USER}/.config/VSCodium/User
|
||||
file_path=/home/${system_user}/.config/VSCodium/User
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/vscodium/${file_name}" "${file_path}/${file_name}"
|
||||
|
||||
@@ -314,13 +316,13 @@ if [ ${operation} == "dots" ] ; then
|
||||
|
||||
# i3
|
||||
file_name=config
|
||||
file_path=/home/${USER}/.config/i3
|
||||
file_path=/home/${system_user}/.config/i3
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/i3wm/${file_name}" "${file_path}/"
|
||||
|
||||
# i3status
|
||||
file_name=config
|
||||
file_path=/home/${USER}/.config/i3status
|
||||
file_path=/home/${system_user}/.config/i3status
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dots_trg}/i3status/${file_name}" "${file_path}/"
|
||||
|
||||
@@ -329,13 +331,13 @@ if [ ${operation} == "dots" ] ; then
|
||||
if [ ${I3WM} == "true" ] || [ ${QTILE} == "true" ] ; then
|
||||
|
||||
# xorg
|
||||
file_path=/home/${USER}
|
||||
file_path=/home/${system_user}
|
||||
deploy_file "${dots_trg}/xorg/.*" "${file_path}/"
|
||||
|
||||
# lemurs (display/login manager)
|
||||
file_name_src=.xinitrc
|
||||
file_name_trg=i3
|
||||
file_path_src=/home/${USER}
|
||||
file_path_src=/home/${system_user}
|
||||
file_path_trg=/etc/lemurs/wms
|
||||
if [ -f ${file_path_trg}/${file_name_trg} ] ; then
|
||||
echo ""
|
||||
@@ -345,7 +347,7 @@ if [ ${operation} == "dots" ] ; then
|
||||
echo ""
|
||||
echo "creating soft link: ${file_path_src}/${file_name_src} ➔ ${file_path_trg}/${file_name_trg}"
|
||||
ln -s ${file_path_src}/${file_name_src} ${file_path_trg}/${file_name_trg}
|
||||
chown -h ${USER}:${USER} ${file_path_trg}/${file_name_trg}
|
||||
chown -h ${system_user}:${system_user} ${file_path_trg}/${file_name_trg}
|
||||
ls -al ${file_path_trg}
|
||||
fi
|
||||
|
||||
@@ -368,21 +370,21 @@ if [ ${operation} == "dots+" ] ; then
|
||||
# ----------
|
||||
# fonts
|
||||
# ----------
|
||||
file_path=/home/${USER}/.local/share/fonts
|
||||
file_path=/home/${system_user}/.local/share/fonts
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dotsplus_trg}/fonts/install/*" "${file_path}/"
|
||||
|
||||
# ----------
|
||||
# images
|
||||
# ----------
|
||||
file_path=/home/${USER}/.local/share/img
|
||||
file_path=/home/${system_user}/.local/share/img
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dotsplus_trg}/images/*" "${file_path}/"
|
||||
|
||||
# ----------
|
||||
# wallpapers
|
||||
# ----------
|
||||
file_path=/home/${USER}/.local/share/wp
|
||||
file_path=/home/${system_user}/.local/share/wp
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dotsplus_trg}/wallpapers/install/*" "${file_path}/"
|
||||
|
||||
@@ -394,7 +396,7 @@ if [ ${operation} == "dots+" ] ; then
|
||||
# https://vscodethemes.com/e/sdras.night-owl/night-owl-no-italics?language=javascript
|
||||
# https://github.com/sdras/night-owl-vscode-theme/tree/main/themes
|
||||
file_name=night-owl-vscode-theme-main.zip
|
||||
file_path=/home/${USER}/.vscode-oss/extensions
|
||||
file_path=/home/${system_user}/.vscode-oss/extensions
|
||||
mkdir -p ${file_path}
|
||||
deploy_file "${dotsplus_trg}/miscellaneous/${file_name}" "${file_path}/" chown recursive
|
||||
|
||||
|
||||
Reference in New Issue
Block a user