mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 11:07:00 +08:00
debug
This commit is contained in:
parent
c7f3a19091
commit
f48d0912f9
23
install.sh
23
install.sh
|
@ -101,7 +101,7 @@ crontab_job="0 * * * * cd ${dotfile_path} && env git pull"
|
||||||
ask_for_yN()
|
ask_for_yN()
|
||||||
{
|
{
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$1 [yN]: " yn
|
read -p "${FMT_YELLOW}$1${FMT_RESET} [yN]: " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) return 1;;
|
[Yy]* ) return 1;;
|
||||||
[Nn]* ) return 0;;
|
[Nn]* ) return 0;;
|
||||||
|
@ -127,7 +127,7 @@ delete_if_exist()
|
||||||
line=$2
|
line=$2
|
||||||
fmt_note "removing \"$line\" from \"$filename\" ..."
|
fmt_note "removing \"$line\" from \"$filename\" ..."
|
||||||
if [ -f "$filename" ]; then
|
if [ -f "$filename" ]; then
|
||||||
grep -vxF -- "$line" "$filename" >> "$filename"
|
grep -vxF -- "$line" "$filename" | tee "$filename"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,9 +143,9 @@ create_symlink()
|
||||||
if [ -f "$dest" ]; then
|
if [ -f "$dest" ]; then
|
||||||
fmt_warning "\"$dest\" already exists! stat output:"
|
fmt_warning "\"$dest\" already exists! stat output:"
|
||||||
echo ----------
|
echo ----------
|
||||||
env stat $dest
|
stat $dest
|
||||||
echo ----------
|
echo ----------
|
||||||
ask_for_yN "${FMT_YELLOW}would you like to replace ${dest}?${FMT_RESET}"
|
ask_for_yN "would you like to replace ${dest}?"
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
rm $dest
|
rm $dest
|
||||||
else
|
else
|
||||||
|
@ -163,7 +163,7 @@ delete_link_if_match()
|
||||||
if [ "$(readlink $dest)" -ef "$src" ]; then
|
if [ "$(readlink $dest)" -ef "$src" ]; then
|
||||||
fmt_note "removing symlink \"$dest\" ..."
|
fmt_note "removing symlink \"$dest\" ..."
|
||||||
echo ----------
|
echo ----------
|
||||||
env stat $dest
|
stat $dest
|
||||||
echo ----------
|
echo ----------
|
||||||
rm $dest
|
rm $dest
|
||||||
fi
|
fi
|
||||||
|
@ -188,15 +188,18 @@ install(){
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall(){
|
uninstall(){
|
||||||
uninstall_crontab
|
ask_for_yN "do you really want to uninstall?"
|
||||||
delete_if_exist "${HOME}/.zshrc" "source ${dotfile_home_path}/.zshrc2"
|
if [[ $? == 1 ]]; then
|
||||||
delete_link_if_match "${dotfile_path}/.ssh/authorized_keys2" "${HOME}/.ssh/authorized_keys2"
|
uninstall_crontab
|
||||||
fmt_note "done uninstalling!"
|
delete_if_exist "${HOME}/.zshrc" "source ${dotfile_home_path}/.zshrc2"
|
||||||
|
delete_link_if_match "${dotfile_path}/.ssh/authorized_keys2" "${HOME}/.ssh/authorized_keys2"
|
||||||
|
fmt_note "done uninstalling!"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_color
|
setup_color
|
||||||
case $1 in
|
case $1 in
|
||||||
^$|-i ) install ;;
|
""|-i ) install ;;
|
||||||
-r ) uninstall ;;
|
-r ) uninstall ;;
|
||||||
* ) echo "unknown command \"$1\". available: -i, -r" ;;
|
* ) echo "unknown command \"$1\". available: -i, -r" ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue
Block a user