mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
Improve skipping installation (#339)
This commit is contained in:
parent
38fd7195ef
commit
e95d2e88d6
2 changed files with 72 additions and 38 deletions
74
install.sh
74
install.sh
|
|
@ -42,9 +42,12 @@ set -e
|
|||
printf "\e[36m[$0]: 1. Get packages and add user to video/input groups\n\e[0m"
|
||||
|
||||
# Issue #363
|
||||
v sudo pacman -Syu
|
||||
case $SKIP_SYSUPDATE in
|
||||
true) sleep 0;;
|
||||
*) v sudo pacman -Syu;;
|
||||
esac
|
||||
|
||||
remove_bashcomments_emptylines ./scriptdata/dependencies.conf ./cache/dependencies_stripped.conf
|
||||
remove_bashcomments_emptylines ${DEPLISTFILE} ./cache/dependencies_stripped.conf
|
||||
readarray -t pkglist < ./cache/dependencies_stripped.conf
|
||||
|
||||
if ! command -v yay >/dev/null 2>&1;then
|
||||
|
|
@ -92,13 +95,18 @@ v sudo usermod -aG video,input "$(whoami)"
|
|||
printf "\e[36m[$0]: 2. Installing parts from source repo\e[0m\n"
|
||||
sleep 1
|
||||
|
||||
if command -v ags >/dev/null 2>&1;then
|
||||
echo -e "\e[33m[$0]: Command \"ags\" already exists, no need to install.\e[0m"
|
||||
echo -e "\e[34mYou can reinstall it in order to update to the latest version anyway.\e[0m"
|
||||
ask_ags=$ask
|
||||
else ask_ags=true
|
||||
fi
|
||||
if $ask_ags;then showfun install-ags;v install-ags;fi
|
||||
case $SKIP_AGS in
|
||||
true) sleep 0;;
|
||||
*)
|
||||
if command -v ags >/dev/null 2>&1;then
|
||||
echo -e "\e[33m[$0]: Command \"ags\" already exists, no need to install.\e[0m"
|
||||
echo -e "\e[34mYou can reinstall it in order to update to the latest version anyway.\e[0m"
|
||||
ask_ags=$ask
|
||||
else ask_ags=true
|
||||
fi
|
||||
if $ask_ags;then showfun install-ags;v install-ags;fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if $(fc-list|grep -q Rubik); then
|
||||
echo -e "\e[33m[$0]: Font \"Rubik\" already exists, no need to install.\e[0m"
|
||||
|
|
@ -150,27 +158,37 @@ v mkdir -p "$HOME"/.{config,cache,local/{bin,share}}
|
|||
# original dotfiles and new ones in the SAME DIRECTORY
|
||||
# (eg. in ~/.config/hypr) won't be mixed together
|
||||
|
||||
# For .config/* but not AGS, not Hyprland
|
||||
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'hypr' -exec basename {} \;); do
|
||||
i=".config/$i"
|
||||
echo "[$0]: Found target: $i"
|
||||
if [ -d "$i" ];then v rsync -av --delete "$i/" "$HOME/$i/"
|
||||
elif [ -f "$i" ];then v rsync -av "$i" "$HOME/$i"
|
||||
fi
|
||||
done
|
||||
# MISC (For .config/* but not AGS, not Hyprland)
|
||||
case $SKIP_MISCCONF in
|
||||
true) sleep 0;;
|
||||
*)
|
||||
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'hypr' -exec basename {} \;); do
|
||||
i=".config/$i"
|
||||
echo "[$0]: Found target: $i"
|
||||
if [ -d "$i" ];then v rsync -av --delete "$i/" "$HOME/$i/"
|
||||
elif [ -f "$i" ];then v rsync -av "$i" "$HOME/$i"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# For AGS
|
||||
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/
|
||||
t="$HOME/.config/ags/user_options.js"
|
||||
if [ -f $t ];then
|
||||
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
|
||||
# v cp -f .config/ags/user_options.js $t.new
|
||||
existed_ags_opt=y
|
||||
else
|
||||
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m"
|
||||
v cp .config/ags/user_options.js $t
|
||||
existed_ags_opt=n
|
||||
fi
|
||||
case $SKIP_AGS in
|
||||
true) sleep 0;;
|
||||
*)
|
||||
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/
|
||||
t="$HOME/.config/ags/user_options.js"
|
||||
if [ -f $t ];then
|
||||
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
|
||||
# v cp -f .config/ags/user_options.js $t.new
|
||||
existed_ags_opt=y
|
||||
else
|
||||
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m"
|
||||
v cp .config/ags/user_options.js $t
|
||||
existed_ags_opt=n
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Hyprland
|
||||
v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$HOME"/.config/hypr/
|
||||
|
|
|
|||
|
|
@ -10,10 +10,14 @@ echo -e "Syntax: $0 [Options]...
|
|||
Idempotent installation script for dotfiles.
|
||||
If no option is specified, run default install process.
|
||||
|
||||
-h, --help Print this help message and exit
|
||||
-f, --force (Dangerous) Force mode without any confirm
|
||||
-c, --clean Clean the build cache first
|
||||
-k, --kbset <set> (Unavailable yet) Use a set of pre-defined keybindings
|
||||
-h, --help Print this help message and exit
|
||||
-f, --force (Dangerous) Force mode without any confirm
|
||||
-c, --clean Clean the build cache first
|
||||
-s, --skip-sysupdate Skip \"sudo pacman -Syu\"
|
||||
--skip-ags Skip installing ags and its config
|
||||
--skip-miscconf Skip copying the dirs and files to \".configs\" except for AGS and Hyprland
|
||||
--deplistfile <path> Specify a dependency list file. By default \"./scriptdata/dependencies.conf\"
|
||||
--fontset <set> (Unavailable yet) Use a set of pre-defined font and config
|
||||
"
|
||||
}
|
||||
|
||||
|
|
@ -23,8 +27,8 @@ cleancache(){
|
|||
|
||||
# `man getopt` to see more
|
||||
para=$(getopt \
|
||||
-o hfk:c \
|
||||
-l help,force,kbset:,clean \
|
||||
-o hfk:cs \
|
||||
-l help,force,fontset:,deplistfile:,clean,skip-sysupdate,skip-ags,skip-miscconf \
|
||||
-n "$0" -- "$@")
|
||||
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
||||
#####################################################################################
|
||||
|
|
@ -41,6 +45,8 @@ while true ; do
|
|||
done
|
||||
#####################################################################################
|
||||
## getopt Phase 2
|
||||
DEPLISTFILE=./scriptdata/dependencies.conf
|
||||
|
||||
eval set -- "$para"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
|
|
@ -48,14 +54,24 @@ while true ; do
|
|||
-c|--clean) shift;;
|
||||
## Ones without parameter
|
||||
-f|--force) ask=false;shift;;
|
||||
-s|--skip-sysupdate) SKIP_SYSUPDATE=true;shift;;
|
||||
--skip-ags) SKIP_AGS=true;shift;;
|
||||
--skip-miscconf) SKIP_MISCCONF=true;shift;;
|
||||
## Ones with parameter
|
||||
|
||||
-k|--kbset)
|
||||
--deplistfile)
|
||||
if [ -f "$2" ];then
|
||||
DEPLISTFILE="$2"
|
||||
else
|
||||
echo -e "Deplist file \"$2\" does not exist.";exit 1
|
||||
fi
|
||||
shift 2 ;;
|
||||
|
||||
--fontset)
|
||||
case $2 in
|
||||
"normal") kbname="Normal style";;
|
||||
"vim") kbname="Vim-style";;
|
||||
"default"|"zh-CN"|"vi") fontset="$2";;
|
||||
*) echo -e "Wrong argument for $1.";exit 1;;
|
||||
esac;echo "The keyboardset is ${kbname}.";shift 2;;
|
||||
esac;echo "The fontset is ${fontset}.";shift 2;;
|
||||
|
||||
## Ending
|
||||
--) break ;;
|
||||
|
|
|
|||
Loading…
Reference in a new issue