2022-04-02 14:33:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
IFS=$'\n'
|
|
|
|
|
|
|
|
# generate makepkg.conf
|
|
|
|
MAKEPKG_ENV_VARS=($(env | sort | grep --perl-regexp '^MAKEPKG_.*'))
|
|
|
|
for ENV_VAR in ${MAKEPKG_ENV_VARS[@]}; do
|
|
|
|
KEY=$(echo ${ENV_VAR} | cut --delimiter="=" --fields="1" | sed 's/MAKEPKG_//' | tr '[:lower:]' '[:upper:]')
|
|
|
|
VALUE=$(echo ${ENV_VAR} | cut --delimiter="=" --fields="2-")
|
|
|
|
echo "${KEY}='${VALUE}'" >> ${HOME}/.makepkg.conf
|
|
|
|
done
|
|
|
|
|
|
|
|
# import gpg key
|
|
|
|
if [ ! -z ${GPG_KEY+x} ]; then
|
|
|
|
echo -e ${GPG_KEY} | gpg --import
|
|
|
|
|
|
|
|
# trust gpg key
|
|
|
|
for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u); do
|
|
|
|
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key $fpr trust
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# add ssh private key
|
|
|
|
if [ ! -z ${SSH_KEY+x} ]; then
|
|
|
|
mkdir --parents ${HOME}/.ssh
|
|
|
|
sudo chmod 0700 ${HOME}/.ssh
|
|
|
|
echo -e ${SSH_KEY} > ${HOME}/.ssh/key
|
|
|
|
sudo chmod 0600 ${HOME}/.ssh/key
|
2023-02-05 10:08:49 +00:00
|
|
|
echo -e "Host *\n IdentityFile ~/.ssh/key\n StrictHostKeyChecking no\n UserKnownHostsFile /dev/null\n" > ${HOME}/.ssh/config
|
2022-04-02 14:33:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
/bin/bash ${@}
|