99_download.sh > 99_deploy.sh
This commit is contained in:
88
scripts/99_deploy.sh
Normal file
88
scripts/99_deploy.sh
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# klevstul
|
||||
|
||||
echo "<< 99_deploy.sh >>"
|
||||
|
||||
user=poq
|
||||
clone_trg=/tmp
|
||||
|
||||
targz_dots_url=https://git.mz.fo/fro/lnx-arch/archive/master.tar.gz
|
||||
dots_trg=${clone_trg}/lnx-arch/dots
|
||||
|
||||
targz_wp_url=https://gitlab.com/pqq/wallpaper/-/archive/main/wallpaper-main.tar.gz
|
||||
wp_trg=${clone_trg}/wallpaper-main/wp
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "error: run as 'root'"
|
||||
exit
|
||||
fi
|
||||
|
||||
this_file_name=`basename "$0"`
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "usage: '$this_file_name {all}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
operation=$1
|
||||
|
||||
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
|
||||
# helper functions
|
||||
download_repo() {
|
||||
|
||||
_targz_url=$1
|
||||
|
||||
# make clone target directory, if it doesn't exist
|
||||
mkdir -p ${clone_trg}
|
||||
|
||||
# instead of doing a git clone (like `git clone ${clone_url} ${clone_trg}`),
|
||||
# where i would have emptied the target dir each time, i download the
|
||||
# source as a tar.gz.
|
||||
wget --show-progress ${_targz_url} -O ${clone_trg}/tmp.tar.gz
|
||||
tar -xzf ${clone_trg}/tmp.tar.gz -C ${clone_trg}
|
||||
rm ${clone_trg}/tmp.tar.gz
|
||||
|
||||
}
|
||||
|
||||
deploy_file() {
|
||||
_src_path=$1
|
||||
_trg_path=$2
|
||||
|
||||
cp -f ${_src_path} ${_trg_path}
|
||||
chown ${user}:${user} ${_trg_path}
|
||||
|
||||
echo ""
|
||||
echo "${_trg_path}:"
|
||||
ls -al ${_trg_path}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# download all dots (dot files) from repo
|
||||
if [ ${operation} == "dots" ] ; then
|
||||
echo "***** ${operation} *****"
|
||||
download_repo ${targz_dots_url}
|
||||
tree ${clone_trg}/lnx-arch
|
||||
|
||||
file_name=hyprland.conf
|
||||
deploy_file ${dots_trg}/hyprland/${file_name} /home/${user}/.config/hypr/${file_name}
|
||||
|
||||
file_name=hyprpaper.conf
|
||||
deploy_file ${dots_trg}/hyprpaper/${file_name} /home/${user}/.config/hypr/${file_name}
|
||||
|
||||
file_name=startup.sh
|
||||
deploy_file ${dots_trg}/startup/${file_name} /home/${user}/bin/${file_name}
|
||||
|
||||
fi
|
||||
|
||||
# download wallpapers from repo
|
||||
if [ ${operation} == "wp" ] ; then
|
||||
echo "***** ${operation} *****"
|
||||
download_repo ${targz_wp_url}
|
||||
tree ${clone_trg}/wallpaper-main
|
||||
|
||||
deploy_file "${wp_trg}/*" "/home/${user}/.config/hypr/"
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user