forked from Shinonome/dots-hyprland
Improve skipping installation (#339)
This commit is contained in:
+46
-28
@@ -42,9 +42,12 @@ set -e
|
|||||||
printf "\e[36m[$0]: 1. Get packages and add user to video/input groups\n\e[0m"
|
printf "\e[36m[$0]: 1. Get packages and add user to video/input groups\n\e[0m"
|
||||||
|
|
||||||
# Issue #363
|
# 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
|
readarray -t pkglist < ./cache/dependencies_stripped.conf
|
||||||
|
|
||||||
if ! command -v yay >/dev/null 2>&1;then
|
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"
|
printf "\e[36m[$0]: 2. Installing parts from source repo\e[0m\n"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
if command -v ags >/dev/null 2>&1;then
|
case $SKIP_AGS in
|
||||||
echo -e "\e[33m[$0]: Command \"ags\" already exists, no need to install.\e[0m"
|
true) sleep 0;;
|
||||||
echo -e "\e[34mYou can reinstall it in order to update to the latest version anyway.\e[0m"
|
*)
|
||||||
ask_ags=$ask
|
if command -v ags >/dev/null 2>&1;then
|
||||||
else ask_ags=true
|
echo -e "\e[33m[$0]: Command \"ags\" already exists, no need to install.\e[0m"
|
||||||
fi
|
echo -e "\e[34mYou can reinstall it in order to update to the latest version anyway.\e[0m"
|
||||||
if $ask_ags;then showfun install-ags;v install-ags;fi
|
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
|
if $(fc-list|grep -q Rubik); then
|
||||||
echo -e "\e[33m[$0]: Font \"Rubik\" already exists, no need to install.\e[0m"
|
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
|
# original dotfiles and new ones in the SAME DIRECTORY
|
||||||
# (eg. in ~/.config/hypr) won't be mixed together
|
# (eg. in ~/.config/hypr) won't be mixed together
|
||||||
|
|
||||||
# For .config/* but not AGS, not Hyprland
|
# MISC (For .config/* but not AGS, not Hyprland)
|
||||||
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'hypr' -exec basename {} \;); do
|
case $SKIP_MISCCONF in
|
||||||
i=".config/$i"
|
true) sleep 0;;
|
||||||
echo "[$0]: Found target: $i"
|
*)
|
||||||
if [ -d "$i" ];then v rsync -av --delete "$i/" "$HOME/$i/"
|
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'hypr' -exec basename {} \;); do
|
||||||
elif [ -f "$i" ];then v rsync -av "$i" "$HOME/$i"
|
i=".config/$i"
|
||||||
fi
|
echo "[$0]: Found target: $i"
|
||||||
done
|
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
|
# For AGS
|
||||||
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/
|
case $SKIP_AGS in
|
||||||
t="$HOME/.config/ags/user_options.js"
|
true) sleep 0;;
|
||||||
if [ -f $t ];then
|
*)
|
||||||
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
|
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/
|
||||||
# v cp -f .config/ags/user_options.js $t.new
|
t="$HOME/.config/ags/user_options.js"
|
||||||
existed_ags_opt=y
|
if [ -f $t ];then
|
||||||
else
|
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
|
||||||
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m"
|
# v cp -f .config/ags/user_options.js $t.new
|
||||||
v cp .config/ags/user_options.js $t
|
existed_ags_opt=y
|
||||||
existed_ags_opt=n
|
else
|
||||||
fi
|
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
|
# For Hyprland
|
||||||
v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$HOME"/.config/hypr/
|
v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$HOME"/.config/hypr/
|
||||||
|
|||||||
+26
-10
@@ -10,10 +10,14 @@ echo -e "Syntax: $0 [Options]...
|
|||||||
Idempotent installation script for dotfiles.
|
Idempotent installation script for dotfiles.
|
||||||
If no option is specified, run default install process.
|
If no option is specified, run default install process.
|
||||||
|
|
||||||
-h, --help Print this help message and exit
|
-h, --help Print this help message and exit
|
||||||
-f, --force (Dangerous) Force mode without any confirm
|
-f, --force (Dangerous) Force mode without any confirm
|
||||||
-c, --clean Clean the build cache first
|
-c, --clean Clean the build cache first
|
||||||
-k, --kbset <set> (Unavailable yet) Use a set of pre-defined keybindings
|
-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
|
# `man getopt` to see more
|
||||||
para=$(getopt \
|
para=$(getopt \
|
||||||
-o hfk:c \
|
-o hfk:cs \
|
||||||
-l help,force,kbset:,clean \
|
-l help,force,fontset:,deplistfile:,clean,skip-sysupdate,skip-ags,skip-miscconf \
|
||||||
-n "$0" -- "$@")
|
-n "$0" -- "$@")
|
||||||
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
@@ -41,6 +45,8 @@ while true ; do
|
|||||||
done
|
done
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
## getopt Phase 2
|
## getopt Phase 2
|
||||||
|
DEPLISTFILE=./scriptdata/dependencies.conf
|
||||||
|
|
||||||
eval set -- "$para"
|
eval set -- "$para"
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -48,14 +54,24 @@ while true ; do
|
|||||||
-c|--clean) shift;;
|
-c|--clean) shift;;
|
||||||
## Ones without parameter
|
## Ones without parameter
|
||||||
-f|--force) ask=false;shift;;
|
-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
|
## 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
|
case $2 in
|
||||||
"normal") kbname="Normal style";;
|
"default"|"zh-CN"|"vi") fontset="$2";;
|
||||||
"vim") kbname="Vim-style";;
|
|
||||||
*) echo -e "Wrong argument for $1.";exit 1;;
|
*) 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
|
## Ending
|
||||||
--) break ;;
|
--) break ;;
|
||||||
|
|||||||
Reference in New Issue
Block a user