+ initial files
This commit is contained in:
65
scripts/99_dots.sh
Normal file
65
scripts/99_dots.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# klevstul
|
||||
|
||||
echo "<< 99_dots.sh >>"
|
||||
|
||||
user=poq
|
||||
base_url=https://git.mz.fo/fro/lnx-arch/raw/branch/master
|
||||
targz_url=https://git.mz.fo/fro/lnx-arch/archive/master.tar.gz
|
||||
clone_trg=/tmp
|
||||
dots_trg=${clone_trg}/lnx-arch/dots
|
||||
|
||||
|
||||
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 function
|
||||
download_repo() {
|
||||
|
||||
# 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
|
||||
|
||||
}
|
||||
|
||||
|
||||
# download all dots (dot files) from repo
|
||||
if [ ${operation} == "all" ] ; then
|
||||
echo "***** ${operation} *****"
|
||||
download_repo
|
||||
tree ${clone_trg}/lnx-arch
|
||||
|
||||
target_file_name=hyprland.conf
|
||||
target_file_path=/home/${user}/.config/hypr/${target_file_name}
|
||||
cp -f ${dots_trg}/hyprland/${target_file_name} ${target_file_path}
|
||||
chown ${user}:${user} ${target_file_path}
|
||||
ls -al ${target_file_path}
|
||||
|
||||
target_file_name=hyprpaper.conf
|
||||
target_file_path=/home/${user}/.config/hypr/${target_file_name}
|
||||
cp -f ${dots_trg}/hyprpaper/${target_file_name} ${target_file_path}
|
||||
chown ${user}:${user} ${target_file_path}
|
||||
ls -al ${target_file_path}
|
||||
|
||||
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user