minor: 将 config_git_gpg 从 user 转移都 priv
This commit is contained in:
parent
09cadf0161
commit
8cc966dde8
@ -475,6 +475,30 @@ configure_node_exporter() {
|
||||
# fi
|
||||
# }
|
||||
|
||||
configure_git_gpg() {
|
||||
! command_exists git && return
|
||||
[ ! -f ~/.gitconfig ] && return
|
||||
[ -n "$(git config --global user.signingkey)" ] && return
|
||||
|
||||
if confirm_action "要配置 git 使用 gpg 签名吗?" "N"; then
|
||||
if ! command_exists 7za; then
|
||||
sudo apt install p7zip-full -y
|
||||
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_swap() {
|
||||
|
||||
@ -47,31 +47,6 @@ configure_gpg() {
|
||||
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
|
||||
@ -136,7 +111,6 @@ configure_ssh
|
||||
configure_ssh_keygen
|
||||
configure_git
|
||||
configure_gpg
|
||||
configure_git_gpg
|
||||
configure_miniconda
|
||||
configure_miniforge
|
||||
configure_nvm
|
||||
|
||||
Loading…
Reference in New Issue
Block a user