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