Compare commits
No commits in common. "8c822383656f8dc451c574a0dc1b957d4bde31bf" and "50c81fcaa35b947a3bd19b340230644fd26ccf25" have entirely different histories.
8c82238365
...
50c81fcaa3
@ -61,7 +61,7 @@ configure_install_basic() {
|
||||
configure_install_useful() {
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
[ "$1" != "noupdate" ] && brew update
|
||||
brew install hexyl bat tree p7zip-full
|
||||
brew install hexyl bat tree
|
||||
else
|
||||
[ "$1" != "noupdate" ] && sudo apt-get update
|
||||
sudo apt-get install hexyl bat tree fd-find fzf tcptraceroute -y
|
||||
@ -186,7 +186,7 @@ configure_zsh() {
|
||||
if ! grep -q "conda initialize" ~/.zshrc; then
|
||||
if [ -d ~/.miniconda3 ]; then
|
||||
~/.miniconda3/bin/mamba init zsh
|
||||
elif [ -d ~/.miniforge3 ]; then
|
||||
elif [ -d ~/.miniforge3 ]; then
|
||||
~/.miniforge3/bin/mamba init zsh
|
||||
fi
|
||||
fi
|
||||
@ -307,8 +307,7 @@ configure_nginx() {
|
||||
fi
|
||||
if confirm_action "要安装 nginx 吗?" "Y"; then
|
||||
sudo apt-get update
|
||||
# TODO E: Version '1.20.2-1~noble' for 'nginx' was not found
|
||||
sudo apt-get install nginx=1.20.2-1~$(lsb_release -cs) -y
|
||||
sudo apt-get install nginx=1.20.2-1~$(lsb_release -cs) -y # TODO E: Version '1.20.2-1~noble' for 'nginx' was not found
|
||||
echo "别忘了把 /etc/nginx/sites-enabled 中的配置文件移动到 /etc/nginx/conf.d 中"
|
||||
fi
|
||||
}
|
||||
@ -437,8 +436,8 @@ configure_node_exporter() {
|
||||
rm $node_exporter_dir -r
|
||||
|
||||
# Generate a self-signed certificate
|
||||
# openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout node_exporter.key -out node_exporter.crt
|
||||
# -subj "/C=CN/ST=Beijing/L=Beijing/O=nano.ac/CN=localhost"
|
||||
# openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout node_exporter.key -out node_exporter.crt
|
||||
# -subj "/C=CN/ST=Beijing/L=Beijing/O=nano.ac/CN=localhost"
|
||||
# -addext "subjectAltName=DNS:localhost,DNS:host.docker.internal,DNS:*.nano.ac,DNS:*.c-4.cc"
|
||||
|
||||
if [ ! -d "/etc/node_exporter" ]; then
|
||||
|
||||
@ -37,41 +37,6 @@ configure_git() {
|
||||
fi
|
||||
}
|
||||
|
||||
configure_gpg() {
|
||||
[ -d ~/.gnupg ] && [ -f ~/.gnupg/gpg.conf ] && return
|
||||
|
||||
if confirm_action "要配置 gpg 吗?" "Y"; then
|
||||
mkdir -p ~/.gnupg
|
||||
chmod 700 ~/.gnupg
|
||||
cp $scriptdir/files/gpg.conf ~/.gnupg/gpg.conf
|
||||
fi
|
||||
}
|
||||
|
||||
configure_git_gpg() {
|
||||
[ ! -f ~/.gitconfig ] && return
|
||||
! command_exists git && return
|
||||
[ -n "$(git config --global user.signingkey)" ] && return
|
||||
|
||||
if confirm_action "要配置 git 使用 gpg 签名吗?" "N"; then
|
||||
if ! command_exists 7za; then
|
||||
echo "7zip 未安装,请运行 sudo apt install p7zip-full 安装"
|
||||
return
|
||||
fi
|
||||
read_password
|
||||
cp $scriptdir/files/git.key.zip $tempdir/git.key.zip
|
||||
7za x -p$password $tempdir/git.key.zip -o$tempdir > /dev/null 2>&1
|
||||
rm $tempdir/git.key.zip
|
||||
if [ ! -s $tempdir/git.key ]; then
|
||||
echo "Wrong password!"
|
||||
return
|
||||
fi
|
||||
gpg --import $tempdir/git.key
|
||||
rm $tempdir/git.key
|
||||
git config --global user.signingkey 4ACB54FB3EFF978038BFB374A523E440E24B89CF
|
||||
git config --global commit.gpgSign true
|
||||
fi
|
||||
}
|
||||
|
||||
configure_miniconda() {
|
||||
[ -d ~/.miniconda3 ] && return
|
||||
[ $offline -eq 1 ] && return
|
||||
@ -120,6 +85,16 @@ configure_nvm() {
|
||||
fi
|
||||
}
|
||||
|
||||
configure_gpg() {
|
||||
[ -d ~/.gnupg ] && [ -f ~/.gnupg/gpg.conf ] && return
|
||||
|
||||
if confirm_action "要配置 gpg 吗?" "Y"; then
|
||||
mkdir -p ~/.gnupg
|
||||
chmod 700 ~/.gnupg
|
||||
cp $scriptdir/files/gpg.conf ~/.gnupg/gpg.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
@ -127,7 +102,6 @@ if [ $# -ne 0 ]; then
|
||||
declare -F configure_$func >/dev/null || continue
|
||||
echo "Configuring $func..."
|
||||
eval "configure_$func"
|
||||
unset -f configure_$func
|
||||
done
|
||||
return
|
||||
fi
|
||||
@ -135,8 +109,7 @@ fi
|
||||
configure_ssh
|
||||
configure_ssh_keygen
|
||||
configure_git
|
||||
configure_gpg
|
||||
configure_git_gpg
|
||||
configure_miniconda
|
||||
configure_miniforge
|
||||
configure_nvm
|
||||
configure_gpg
|
||||
|
||||
Binary file not shown.
21
utils.sh
21
utils.sh
@ -56,7 +56,7 @@ confirm_action() {
|
||||
}
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
command -v "$@" >/dev/null 2>&1;
|
||||
}
|
||||
|
||||
pkg_install() {
|
||||
@ -69,25 +69,6 @@ pkg_install() {
|
||||
fi
|
||||
}
|
||||
|
||||
read_password() {
|
||||
echo -n "Password: "
|
||||
password=""
|
||||
while IFS= read -r -s -n1 char; do
|
||||
if [[ $char == $'\0' ]]; then
|
||||
break
|
||||
elif [[ $char == $'\177' ]]; then
|
||||
if [ -n "$password" ]; then
|
||||
password=${password%?}
|
||||
echo -ne "\b \b"
|
||||
fi
|
||||
else
|
||||
password+="$char"
|
||||
echo -n "*"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
|
||||
check_internet_access
|
||||
|
||||
Loading…
Reference in New Issue
Block a user