add update_files
This commit is contained in:
parent
6167670169
commit
b2b596c7cf
26
init_root.sh
26
init_root.sh
@ -23,6 +23,16 @@ git_clone() {
|
|||||||
fi
|
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() {
|
check_google_access() {
|
||||||
@ -40,6 +50,10 @@ check_google_access() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_files() {
|
||||||
|
update_file $scriptdir/files/ys-simple.zsh-theme ~/.oh-my-zsh/themes/ys-simple.zsh-theme
|
||||||
|
}
|
||||||
|
|
||||||
configure_ssh() {
|
configure_ssh() {
|
||||||
[ -f ~/.ssh/authorized_keys ] && return
|
[ -f ~/.ssh/authorized_keys ] && return
|
||||||
|
|
||||||
@ -232,7 +246,18 @@ configure_git() {
|
|||||||
fi
|
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
|
check_google_access
|
||||||
|
update_files
|
||||||
configure_ssh
|
configure_ssh
|
||||||
configure_ssh_keygen
|
configure_ssh_keygen
|
||||||
configure_nano
|
configure_nano
|
||||||
@ -248,3 +273,4 @@ configure_timedate
|
|||||||
configure_fail2ban
|
configure_fail2ban
|
||||||
configure_miniconda
|
configure_miniconda
|
||||||
configure_git
|
configure_git
|
||||||
|
# configure_docker
|
||||||
|
|||||||
26
init_sudo.sh
26
init_sudo.sh
@ -28,6 +28,16 @@ git_clone() {
|
|||||||
fi
|
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() {
|
check_google_access() {
|
||||||
@ -45,6 +55,10 @@ check_google_access() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_files() {
|
||||||
|
update_file $scriptdir/files/ys-simple.zsh-theme ~/.oh-my-zsh/themes/ys-simple.zsh-theme
|
||||||
|
}
|
||||||
|
|
||||||
configure_ssh() {
|
configure_ssh() {
|
||||||
[ -f ~/.ssh/authorized_keys ] && return
|
[ -f ~/.ssh/authorized_keys ] && return
|
||||||
|
|
||||||
@ -238,7 +252,18 @@ configure_git() {
|
|||||||
fi
|
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
|
check_google_access
|
||||||
|
update_files
|
||||||
configure_ssh
|
configure_ssh
|
||||||
configure_ssh_keygen
|
configure_ssh_keygen
|
||||||
configure_nano
|
configure_nano
|
||||||
@ -254,3 +279,4 @@ configure_timedate
|
|||||||
configure_fail2ban
|
configure_fail2ban
|
||||||
configure_miniconda
|
configure_miniconda
|
||||||
configure_git
|
configure_git
|
||||||
|
# configure_docker_rootless
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user