mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-04 15:10:29 +08:00
install.sh: -x to set dfs config; ci
This commit is contained in:
parent
e24b15edd1
commit
25a74c15b4
31
install.sh
31
install.sh
@ -10,6 +10,7 @@ fi
|
|||||||
DOTFILE_TILDE=${DOTFILES/"$HOME"/\~}
|
DOTFILE_TILDE=${DOTFILES/"$HOME"/\~}
|
||||||
|
|
||||||
CRON_JOB="0 * * * * ${DOTFILES}/update.sh"
|
CRON_JOB="0 * * * * ${DOTFILES}/update.sh"
|
||||||
|
declare -a DFS_CONFIGS
|
||||||
declare -a HOME_FILES_PATH
|
declare -a HOME_FILES_PATH
|
||||||
declare -a HOME_FILES_CONTENT
|
declare -a HOME_FILES_CONTENT
|
||||||
HOME_FILES_PATH[0]=".zshrc"
|
HOME_FILES_PATH[0]=".zshrc"
|
||||||
@ -81,6 +82,26 @@ preinstall_check()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_config()
|
||||||
|
{
|
||||||
|
fmt_note "preparing dotfiles configurations ..."
|
||||||
|
local key value
|
||||||
|
for i in "${DFS_CONFIGS[@]}"; do
|
||||||
|
if [[ $i =~ *=* ]]; then
|
||||||
|
key=${i%%=*}
|
||||||
|
value=${i#*=}
|
||||||
|
else
|
||||||
|
key=$i
|
||||||
|
value=$(eval echo \$$key)
|
||||||
|
fi
|
||||||
|
HOME_FILES_PATH+=(".config/dotfiles/env")
|
||||||
|
HOME_FILES_CONTENT+=("$key=$value")
|
||||||
|
echo -n "$key=$value"
|
||||||
|
export $key=$value
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
install_file_content()
|
install_file_content()
|
||||||
{
|
{
|
||||||
fmt_note "installing file content ..."
|
fmt_note "installing file content ..."
|
||||||
@ -239,6 +260,9 @@ install()
|
|||||||
if [[ "$INSTALL_DEP" == "1" ]]; then install_dependencies; fi
|
if [[ "$INSTALL_DEP" == "1" ]]; then install_dependencies; fi
|
||||||
install_update
|
install_update
|
||||||
preinstall_check
|
preinstall_check
|
||||||
|
if [[ ${#DFS_CONFIGS[@]} > 0 ]]; then
|
||||||
|
prepare_config
|
||||||
|
fi
|
||||||
install_crontab
|
install_crontab
|
||||||
install_file_content
|
install_file_content
|
||||||
install_symlink
|
install_symlink
|
||||||
@ -267,13 +291,18 @@ FUNC=install
|
|||||||
INSTALL_DEP=0
|
INSTALL_DEP=0
|
||||||
store_config=0
|
store_config=0
|
||||||
for i in ${GOT_OPTS[@]}; do
|
for i in ${GOT_OPTS[@]}; do
|
||||||
|
if [[ "$store_config" == "1" ]]; then
|
||||||
|
store_config=0
|
||||||
|
DFS_CONFIGS+=("$i")
|
||||||
|
continue
|
||||||
|
fi
|
||||||
case $i in
|
case $i in
|
||||||
-i ) FUNC=install ;;
|
-i ) FUNC=install ;;
|
||||||
-r ) FUNC=uninstall ;;
|
-r ) FUNC=uninstall ;;
|
||||||
-d|--dev ) export DFS_DEV=1; set -x ;;
|
-d|--dev ) export DFS_DEV=1; set -x ;;
|
||||||
-a|--auto ) INSTALL_DEP=1 ;;
|
-a|--auto ) INSTALL_DEP=1 ;;
|
||||||
-s|--secure ) export DFS_DEV=0 ;;
|
-s|--secure ) export DFS_DEV=0 ;;
|
||||||
-x ) store_config=1 ;; # TODO: store and write to config
|
-x ) store_config=1 ;;
|
||||||
* ) fmt_fatal "unknown option \"$i\"" ;;
|
* ) fmt_fatal "unknown option \"$i\"" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -43,9 +43,10 @@ test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commi
|
|||||||
git reset --hard $DFS_VERSION
|
git reset --hard $DFS_VERSION
|
||||||
|
|
||||||
# then check install.sh
|
# then check install.sh
|
||||||
./install.sh -l
|
./install.sh -l -x DFS_CI=1
|
||||||
dfs version
|
dfs version
|
||||||
test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id`
|
test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id`
|
||||||
|
grep -q "DFS_CI=1" ~/.config/dotfiles/env
|
||||||
|
|
||||||
# clean
|
# clean
|
||||||
git reset --hard $DFS_VERSION
|
git reset --hard $DFS_VERSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user