This commit is contained in:
committer
2024-05-21 07:07:56 -05:00
parent 399a72e5fa
commit 6f82577962
2 changed files with 41 additions and 38 deletions

View File

@@ -16,8 +16,11 @@ if [ $# -lt 1 ]; then
fi
operation=$1
user=${USER}
clone_trg=${CLONE_TARGET_DIR}
clone_trg=${CLONE_TARGET_DIR} # value found in options.sh file, sourced above
if [[ -z "${clone_trg}" ]] ; then
echo "error: CLONE_TARGET_DIR is empty"
exit 1
fi
options_url=https://git.mz.fo/fro/lnx-arch/raw/branch/master/dots/archinstall/${HOSTNAME}/options.sh
options_trg=/tmp/options.sh
@@ -30,7 +33,7 @@ if [ -z "${OPTIONS_LOADED}" ]; then
exit 1
fi
secrets_cred_path=/home/${user}/syncDir/secrets/toBeSources/cred.sh
secrets_cred_path=/home/${USER}/syncDir/secrets/toBeSources/cred.sh
source ${secrets_cred_path}
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@@ -56,7 +59,7 @@ create_dir() {
_directory=$1
mkdir -p ${_directory}
chown ${user}:${user} ${_directory}
chown ${USER}:${USER} ${_directory}
}
deploy_file() {
@@ -91,14 +94,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 ${USER}:${USER} ${_trg_path}*
chown ${USER}:${USER} ${_trg_path}.[^.]*
else
chown -R ${user}:${user} ${_trg_path}*
chown -R ${user}:${user} ${_trg_path}.[^.]*
chown -R ${USER}:${USER} ${_trg_path}*
chown -R ${USER}:${USER} ${_trg_path}.[^.]*
fi
else
chown ${user}:${user} ${_trg_path}
chown ${USER}:${USER} ${_trg_path}
fi
fi
@@ -116,7 +119,7 @@ deploy_file() {
# locate firefox's profile directory
firefox_profile_dir() {
ffdir=/home/${user}/.mozilla/firefox/
ffdir=/home/${USER}/.mozilla/firefox/
if ! [ -d "$ffdir" ]
then
@@ -160,7 +163,7 @@ if [ ${operation} == "dots" ] ; then
# bashrc
file_name=.bashrc
file_path=/home/${user}
file_path=/home/${USER}
deploy_file "${dots_trg}/bash/${file_name}" "${file_path}/${file_name}"
# bin (executable binaries, scripts)
@@ -173,15 +176,15 @@ if [ ${operation} == "dots" ] ; then
deploy_file "${dots_trg}/environment/${file_name}" "${file_path}/${file_name}" no_chown
# mounts
# file_name=nas.mount
# file_path=/etc/systemd/system
# deploy_file "${dots_trg}/systemd/${file_name}" "${file_path}/${file_name}" no_chown
#
# sed -i 's|[USERNAME]|klevstul|g' "${file_path}/${file_name}"
# sed -i 's|[PASSWORD]|${LILLESORTEBOKS}|g' "${file_path}/${file_name}"
#
# mount_target=/mnt/nas
# mkdir -p ${mount_target}
file_name=nas.mount
file_path=/etc/systemd/system
deploy_file "${dots_trg}/systemd/${file_name}" "${file_path}/${file_name}" no_chown
sed -i 's|[USERNAME]|klevstul|g' "${file_path}/${file_name}"
sed -i 's|[PASSWORD]|${LILLESORTEBOKS}|g' "${file_path}/${file_name}"
mount_target=/mnt/nas
mkdir -p ${mount_target}
# ----------
# printing
@@ -245,7 +248,7 @@ if [ ${operation} == "dots" ] ; then
# lf
file_name=lfrc
file_path=/home/${user}/.config/lf
file_path=/home/${USER}/.config/lf
mkdir -p ${file_path}
deploy_file "${dots_trg}/lf/${file_name}" "${file_path}/${file_name}"
@@ -273,35 +276,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/${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/${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/${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/${USER}
deploy_file "${dots_trg}/gtk/${file_name}" "${file_path}/${file_name}"
# nitrogen
file_path=/home/${user}/.config/nitrogen
file_path=/home/${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/${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/${USER}/.config/VSCodium/User
mkdir -p ${file_path}
deploy_file "${dots_trg}/vscodium/${file_name}" "${file_path}/${file_name}"
@@ -310,13 +313,13 @@ if [ ${operation} == "dots" ] ; then
# i3
file_name=config
file_path=/home/${user}/.config/i3
file_path=/home/${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/${USER}/.config/i3status
mkdir -p ${file_path}
deploy_file "${dots_trg}/i3status/${file_name}" "${file_path}/"
@@ -325,13 +328,13 @@ if [ ${operation} == "dots" ] ; then
if [ ${I3WM} == "true" ] || [ ${QTILE} == "true" ] ; then
# xorg
file_path=/home/${user}
file_path=/home/${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/${USER}
file_path_trg=/etc/lemurs/wms
if [ -f ${file_path_trg}/${file_name_trg} ] ; then
echo ""
@@ -341,7 +344,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 ${USER}:${USER} ${file_path_trg}/${file_name_trg}
ls -al ${file_path_trg}
fi
@@ -364,21 +367,21 @@ if [ ${operation} == "dots+" ] ; then
# ----------
# fonts
# ----------
file_path=/home/${user}/.local/share/fonts
file_path=/home/${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/${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/${USER}/.local/share/wp
mkdir -p ${file_path}
deploy_file "${dotsplus_trg}/wallpapers/install/*" "${file_path}/"
@@ -390,7 +393,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/${USER}/.vscode-oss/extensions
mkdir -p ${file_path}
deploy_file "${dotsplus_trg}/miscellaneous/${file_name}" "${file_path}/" chown recursive