added initialization of .ssh directory
parent
f637921bb2
commit
26b6de990d
|
|
@ -24,54 +24,62 @@ fi
|
|||
# Copy ssh keys and config
|
||||
#
|
||||
|
||||
path_ssh="/root/.ssh/"
|
||||
path_ssh="/root/.ssh"
|
||||
path_programm_key="/data/ssh/programm-webhook.deploy.ed25519"
|
||||
path_programm_pub="/data/ssh/programm-webhook.deploy.ed25519"
|
||||
path_assets_key="/data/ssh/assets-webhook.deploy.ed25519"
|
||||
path_assets_pub="/data/ssh/assets-webhook.deploy.ed25519"
|
||||
path_ssh_config="/data/ssh/config"
|
||||
|
||||
# Create .ssh folder if not present
|
||||
if [ ! -d "$path_ssh" ]; then
|
||||
# Create the folder
|
||||
mkdir -p "$path_ssh"
|
||||
echo "Folder created: $path_ssh"
|
||||
fi
|
||||
|
||||
# Copy programm key
|
||||
if [ ! -f "$path_programm_key" ];
|
||||
then
|
||||
echo "Error: repository key $path_programm_key does not exist"
|
||||
else
|
||||
cp "$path_programm_key" "$path_ssh"
|
||||
cp "$path_programm_key" "${path_ssh}/"
|
||||
fi
|
||||
|
||||
# Copy programm public key
|
||||
if [ ! -f "$path_programm_publ" ];
|
||||
then
|
||||
echo "Error: repository public key $path_programm_pub does not exist"
|
||||
else
|
||||
cp "$path_programm_pub" "$path_ssh"
|
||||
cp "$path_programm_pub" "${path_ssh}/"
|
||||
fi
|
||||
|
||||
# Copy assets key
|
||||
if [ ! -f "$path_assets_key" ];
|
||||
then
|
||||
echo "Error: assets key $path_assets_key does not exist"
|
||||
else
|
||||
cp "$path_assets_key" "$path_ssh"
|
||||
cp "$path_assets_key" "${path_ssh}/"
|
||||
fi
|
||||
|
||||
# Copy assets public key
|
||||
if [ ! -f "$path_assets_pub" ];
|
||||
then
|
||||
echo "Error: assets public key $path_assets_pub does not exist"
|
||||
else
|
||||
cp "$path_assets_pub" "$path_ssh"
|
||||
cp "$path_assets_pub" "${path_ssh}/"
|
||||
fi
|
||||
|
||||
# Copy ssh config
|
||||
if [ ! -f "$path_ssh_config" ];
|
||||
then
|
||||
echo "Error: ssh config $path_ssh_config does not exist"
|
||||
else
|
||||
cp "$path_ssh_config" "$path_ssh"
|
||||
cp "$path_ssh_config" "${path_ssh}/"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create known_hosts
|
||||
#
|
||||
|
||||
ssh-keyscan ${GIT_SERVER} >> /root/.ssh/known_hosts
|
||||
|
||||
# Create or append known_hosts
|
||||
ssh-keyscan ${GIT_SERVER} >> "${path_ssh}/known_hosts"
|
||||
|
||||
#
|
||||
# Start webhooks
|
||||
|
|
|
|||
Loading…
Reference in New Issue