You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.0 KiB
45 lines
1.0 KiB
#!/usr/bin/env bash
|
|
|
|
echo "installing packages..."
|
|
#use the right command to install packages
|
|
if [ "$(command -v apt)" ]; then
|
|
apt update > /dev/null
|
|
apt -y install openssh-client openssh-clients > /dev/null
|
|
elif [ "$(command -v yum)" ]; then
|
|
yum update > /dev/null
|
|
yum -y install openssh-client openssh-clients > /dev/null
|
|
elif [ "$(command -v apk)" ]; then
|
|
apk update > /dev/null
|
|
apk add openssh > /dev/null
|
|
else
|
|
echo "could not find a package manager, aborting" >&2
|
|
exit 1
|
|
fi
|
|
echo "done."
|
|
|
|
mkdir /root/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
|
|
echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub
|
|
chmod 0600 /root/.ssh/*
|
|
chmod 700 /root/.ssh
|
|
|
|
case "$DRONE_BRANCH" in
|
|
"dev")
|
|
USER=maxime
|
|
IP=92.132.18.192
|
|
DIR=server/TBasket
|
|
;;
|
|
"production")
|
|
USER=palafour
|
|
IP=193.49.118.205
|
|
DIR=TBasket
|
|
;;
|
|
"")
|
|
echo "DRONE_BRANCH is missing" >&2
|
|
exit 1
|
|
;;
|
|
*)
|
|
echo "branch $1 is unable to perform delivery, authorized branches are 'dev and production' for delivery." >&2
|
|
echo "delivery step skipped"
|
|
exit 0
|
|
esac |