add update_files

This commit is contained in:
Konano 2023-10-22 12:16:49 +08:00
parent 6167670169
commit b2b596c7cf
2 changed files with 52 additions and 0 deletions

View File

@ -23,6 +23,16 @@ git_clone() {
fi
}
update_file() {
local A="$1"
local B="$2"
if [ -f "$A" ] && [ -f "$B" ] && [ "$(cat "$A")" != "$(cat "$B")" ]; then
cp "$A" "$B"
echo "File $B has been updated."
fi
}
# ============================================================
check_google_access() {
@ -40,6 +50,10 @@ check_google_access() {
fi
}
update_files() {
update_file $scriptdir/files/ys-simple.zsh-theme ~/.oh-my-zsh/themes/ys-simple.zsh-theme
}
configure_ssh() {
[ -f ~/.ssh/authorized_keys ] && return
@ -232,7 +246,18 @@ configure_git() {
fi
}
configure_docker() {
[ -f /etc/docker/daemon.json ] && return
read -p "要配置 Docker (Rootless mode) 吗?[N]: " response
if [[ $response =~ ^[Yy]$ ]]; then
cp $scriptdir/files/docker-rootless-daemon.json /etc/docker/daemon.json
fi
}
check_google_access
update_files
configure_ssh
configure_ssh_keygen
configure_nano
@ -248,3 +273,4 @@ configure_timedate
configure_fail2ban
configure_miniconda
configure_git
# configure_docker

View File

@ -28,6 +28,16 @@ git_clone() {
fi
}
update_file() {
local A="$1"
local B="$2"
if [ -f "$A" ] && [ -f "$B" ] && [ "$(cat "$A")" != "$(cat "$B")" ]; then
cp "$A" "$B"
echo "File $B has been updated."
fi
}
# ============================================================
check_google_access() {
@ -45,6 +55,10 @@ check_google_access() {
fi
}
update_files() {
update_file $scriptdir/files/ys-simple.zsh-theme ~/.oh-my-zsh/themes/ys-simple.zsh-theme
}
configure_ssh() {
[ -f ~/.ssh/authorized_keys ] && return
@ -238,7 +252,18 @@ configure_git() {
fi
}
configure_docker_rootless() {
[ -f ~/.config/docker/daemon.json ] && return
read -p "要配置 Docker (Rootless mode) 吗?[N]: " response
if [[ $response =~ ^[Yy]$ ]]; then
cp $scriptdir/files/docker-rootless-daemon.json ~/.config/docker/daemon.json
fi
}
check_google_access
update_files
configure_ssh
configure_ssh_keygen
configure_nano
@ -254,3 +279,4 @@ configure_timedate
configure_fail2ban
configure_miniconda
configure_git
# configure_docker_rootless