Update fedora config
This commit is contained in:
parent
af36cfcba4
commit
d0e2481afd
9 changed files with 22 additions and 74 deletions
|
@ -18,69 +18,28 @@ fi
|
|||
command_exists() { type "$1" &>/dev/null; }
|
||||
|
||||
if command_exists "apt-get"; then
|
||||
sudo apt-get install pass git -y
|
||||
sudo apt-get install git -y
|
||||
elif command_exists "yum"; then
|
||||
sudo yum install pass git -y
|
||||
sudo yum install git -y
|
||||
elif command_exists "pacman"; then
|
||||
sudo pacman -S git --noconfirm --needed
|
||||
sudo pacman -S pass --noconfirm --needed
|
||||
elif command_exists "zypp"; then
|
||||
sudo zypper install pass git -y
|
||||
sudo zypper install git -y
|
||||
elif command_exists "emerge"; then
|
||||
sudo echo Not yet supported, exiting...
|
||||
elif command_exists "apk"; then
|
||||
sudo apk add pass
|
||||
sudo apk add git
|
||||
else
|
||||
echo "Unsupported: unknown package manager and distro"
|
||||
fi
|
||||
|
||||
# Check if GCM is installed
|
||||
if [ -d "${HOME}/git-credential-manager" ]; then
|
||||
echo "Git Credential Manager already installed, skipping..."
|
||||
else
|
||||
if command_exists "apt-get"; then
|
||||
curl $(curl -s https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest | grep "browser_download_url.*gcm-linux_amd64.*.deb" | cut -d : -f 2,3 | tr -d \") -LO
|
||||
chmod 777 ./gcm-linux_amd64.*.deb
|
||||
sudo apt-get install ./gcm-linux_amd64.*.deb -y
|
||||
rm -f ./gcm-linux_amd64.*.deb
|
||||
else
|
||||
# Install git credential manager
|
||||
curl -L https://aka.ms/gcm/linux-install-source.sh | sh
|
||||
rm dotnet-install.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
############################################
|
||||
# Do GPG key stuff for commit verification #
|
||||
############################################
|
||||
git config --global user.name "${GIT_NAME}"
|
||||
git config --global user.email "${GIT_EMAIL}"
|
||||
git-credential-manager configure
|
||||
git config --global commit.gpgsign true
|
||||
git config --global credential.credentialStore gpg
|
||||
|
||||
echo "GPG key ID: ${KEY_ID}"
|
||||
echo "Go to https://github.com/drduh/YubiKey-Guide to set up git with GPG"
|
||||
read -p "Mirrored at https://git.askiiart.net/mirrors/YubiKey-Guide"
|
||||
|
||||
git config --global user.signingkey ${KEY_ID}
|
||||
pass init ${KEY_ID}
|
||||
|
||||
#############
|
||||
# SSH stuff #
|
||||
#############
|
||||
|
||||
# Get SSH key
|
||||
if [ -d "${HOME}/.ssh" ]; then
|
||||
echo "SSH keys already exist, skipping..."
|
||||
else
|
||||
# Generate SSH keys
|
||||
echo
|
||||
# -f: file, -N: passphrase, -t: type
|
||||
ssh-keygen -f ~/.ssh/id_rsa -N "" -t rsa
|
||||
echo
|
||||
fi
|
||||
|
||||
# From https://superuser.com/a/954639
|
||||
# Archived at https://web.archive.org/web/20230606153856/https://superuser.com/a/954639
|
||||
|
@ -91,20 +50,5 @@ chown -R "$USER:$(id -gn)" ~/.gnupg
|
|||
chmod 700 ~/.gnupg
|
||||
# Set permissions to read, write for only yourself, no others
|
||||
chmod 600 ~/.gnupg/*
|
||||
# Fixes dirmngr stuff
|
||||
# Fixes dirmngr stuff (for Arch)
|
||||
sudo chmod 700 $(ls -d $HOME/.gnupg/*/)
|
||||
|
||||
read -p "Done. Now verify your SSH and GPG keys in Git*" </dev/tty
|
||||
|
||||
# Export GPG key
|
||||
gpg --armor --export $KEY_ID
|
||||
echo This is the exported key, copy it and put it in GitHub/Gitea/whatever
|
||||
echo Gitea URL: ${GITEA_URL}/user/settings/keys
|
||||
echo GitHub URL: https://github.com/settings/gpg/new
|
||||
read -p "Press enter when you're done" </dev/tty
|
||||
|
||||
cat ~/.ssh/id_rsa.pub
|
||||
echo This is the SSH public key, copy it and put it in GitHub/Gitea/whatever
|
||||
echo Gitea URL: ${GITEA_URL}/user/settings/keys
|
||||
echo GitHub URL: https://github.com/settings/ssh/new
|
||||
read -p "Press enter when you're done" </dev/tty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue