Compare commits

..

1 commit

Author SHA1 Message Date
13715f25fe test edit
testing
2024-05-08 02:09:22 +00:00
3 changed files with 19 additions and 19 deletions

8
fsss-root.sh Normal file
View file

@ -0,0 +1,8 @@
echo '[INFO] Make sure to run this script as a root user!'
echo '[INFO] Now creating a gpg key, please fill out the inforemation with what you want for forejo to use.'
echo '$ gpg --default-new-key-algo rsa4096 --gen-key'
gpg --default-new-key-algo rsa4096 --gen-key
echo '[INFO] Listing keys'
echo '$ gpg --list-secret-keys --keyid-format=long'
gpg --list-secret-keys --keyid-format=long

View file

@ -1,9 +1,6 @@
#!/bin/bash #!/bin/bash
echo '[NOTICE] Make sure to run this script as the user that forejo runs as, via ssh or with manual ownership grants to your current tty!' echo '[NOTICE] Make sure to run this script as the user that forejo runs as, via ssh or with manual ownership grants to your current tty!'
echo '[NOTICE] If you\'re running this script over sudo or su into the other account this WILL FAIL, gpg will not tolerate it!' #echo '[NOTICE] This script modifes your default git config! If forejo runs as your user, then this will mess up your default git config!'
echo '[NOTICE] While it is not recommended by this script, you can set up gpg in a non-standard directory.'
echo '[NOTICE] If you do so, this script will disable git modifications, regardless of your selection.'
echo '[NOTICE] Otherwise, this script will modify the global git configuation for the user it runs as, and use the default GPG home.'
read -p '"Real Name" for gpg and git [Testing]: ' rname read -p '"Real Name" for gpg and git [Testing]: ' rname
rname=${rname:-Testing} rname=${rname:-Testing}
read -p 'Email [test@test.test]: ' email read -p 'Email [test@test.test]: ' email
@ -16,9 +13,7 @@ temp=~/.gnupg
[[ $overgpg == n || $ovrgpg == N ]] && read -p "GPG home [$temp]: " gpghome [[ $overgpg == n || $ovrgpg == N ]] && read -p "GPG home [$temp]: " gpghome
gpghome=${gpghome:-~/.gnupg} gpghome=${gpghome:-~/.gnupg}
echo "[INFO] Ensuring '$gpghome' exists with the correct permissions" echo "[INFO] Ensuring '$gpghome' exists with the correct permissions"
echo "$ mkdir -p $gpghome"
mkdir -p "$gpghome" mkdir -p "$gpghome"
echo "$ chmod 700 $gpghome"
chmod 700 "$gpghome" chmod 700 "$gpghome"
echo '[INFO] Now creating a gpg key using the real name and email provided' echo '[INFO] Now creating a gpg key using the real name and email provided'
echo "$ GPGHOME=$gpghome gpg --default-new-key-algo rsa4096 --quick-gen-key --batch --passphrase '' \"$rname <$email>\"" echo "$ GPGHOME=$gpghome gpg --default-new-key-algo rsa4096 --quick-gen-key --batch --passphrase '' \"$rname <$email>\""
@ -29,7 +24,6 @@ GNUPGHOME="$gpghome" gpg --list-secret-keys --keyid-format=long
key_id=$(GNUPGHOME="$gpghome" gpg --list-secret-keys --keyid-format=long|grep sec|sed -E 's_.+ .+/([^ ]+) .+_\1_g') key_id=$(GNUPGHOME="$gpghome" gpg --list-secret-keys --keyid-format=long|grep sec|sed -E 's_.+ .+/([^ ]+) .+_\1_g')
echo "[INFO] Detected key: $key_id" echo "[INFO] Detected key: $key_id"
if [[ "${ovrgit}" == "y" || "${ovrgit}" == "Y" ]] ; then if [[ "${ovrgit}" == "y" || "${ovrgit}" == "Y" ]] ; then
echo '[NOTICE] Reconfiguring git!'
echo '[INFO] Having git recognize this as the default signing key for this user...' echo '[INFO] Having git recognize this as the default signing key for this user...'
echo "$ git config --global user.signingkey $key_id" echo "$ git config --global user.signingkey $key_id"
git config --global user.signingkey $key_id git config --global user.signingkey $key_id
@ -39,15 +33,5 @@ if [[ "${ovrgit}" == "y" || "${ovrgit}" == "Y" ]] ; then
echo "$ git config --global user.email \"$email\"" echo "$ git config --global user.email \"$email\""
git config --global user.email "$email" git config --global user.email "$email"
else else
echo '[NOTICE] Not Reconfiguring git!' echo '[INFO] Not Reconfiguring git!'
echo '[INFO] If you want forgejo to use the new gpg key, you\'ll need to set a few keys in `app.ini`.' fi
echo '[INFO] The keys you\'ll need to set are:'
echo '[repository.signing]'
echo "SIGNING_KEY = $key_id"
echo "SIGNING_NAME = $rname"
echo "SIGNING_EMAIL = $email"
echo '[INFO] This script does recommend that you use the default git setup with GPG keys, however.'
[[ $ovrgpg == n || $ovrgpg == N ]] && echo '[NOTICE] I notice you\'re trying to use a non-standard gpg directory'
[[ $ovrgpg == n || $ovrgpg == N ]] && echo '[NOTICE] I have no idea how to make forgejo read from a non-standard gpg dirctory'
[[ $ovrgpg == n || $ovrgpg == N ]] && echo '[NOTICE] So you\'re on your own from here. I hope you know what you\'re doing.'
fi

8
fsss-sudo.sh Normal file
View file

@ -0,0 +1,8 @@
echo '[INFO] Make sure to run this script as a used with sudo!'
echo '[INFO] Now creating a gpg key, please fill out the inforemation with what you want for forejo to use.'
echo '$ gpg --default-new-key-algo rsa4096 --gen-key'
gpg --default-new-key-algo rsa4096 --gen-key
echo '[INFO] Listing keys'
echo '$ gpg --list-secret-keys --keyid-format=long'
gpg --list-secret-keys --keyid-format=long