fix: Install script parse version
* Allow version to be passed with v or V at the beginning of version. This allows users to pass along the actual github tagged version as it is listed on github. * Linting updates
This commit is contained in:
parent
9df0a2e545
commit
c1f6bf41f5
@ -9,8 +9,8 @@ VERSION="1.1.0"
|
|||||||
DOCKER_VERSION="24.0"
|
DOCKER_VERSION="24.0"
|
||||||
|
|
||||||
CDN="https://cdn.coollabs.io/coolify"
|
CDN="https://cdn.coollabs.io/coolify"
|
||||||
OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"')
|
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
|
||||||
OS_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"')
|
OS_VERSION=$(grep -w "VERSION_ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
|
||||||
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',')
|
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',')
|
||||||
DATE=$(date +"%Y%m%d-%H%M%S")
|
DATE=$(date +"%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ esac
|
|||||||
# Ovewrite LATEST_VERSION if user pass a version number
|
# Ovewrite LATEST_VERSION if user pass a version number
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
LATEST_VERSION=$1
|
LATEST_VERSION=$1
|
||||||
|
LATEST_VERSION="${LATEST_VERSION,,}"
|
||||||
|
LATEST_VERSION="${LATEST_VERSION#v}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "-------------"
|
echo -e "-------------"
|
||||||
@ -83,8 +85,8 @@ fi
|
|||||||
echo -e "-------------"
|
echo -e "-------------"
|
||||||
echo -e "Check Docker Configuration..."
|
echo -e "Check Docker Configuration..."
|
||||||
mkdir -p /etc/docker
|
mkdir -p /etc/docker
|
||||||
|
# shellcheck disable=SC2015
|
||||||
test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon.json.original-$DATE || cat >/etc/docker/daemon.json <<EOL
|
test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon.json.original-"$DATE" || cat >/etc/docker/daemon.json <<EOL
|
||||||
{
|
{
|
||||||
"log-driver": "json-file",
|
"log-driver": "json-file",
|
||||||
"log-opts": {
|
"log-opts": {
|
||||||
@ -102,11 +104,15 @@ cat >/etc/docker/daemon.json.coolify <<EOL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOL
|
EOL
|
||||||
cat <<<$(jq . /etc/docker/daemon.json.coolify) >/etc/docker/daemon.json.coolify
|
TEMP_FILE=$(mktemp)
|
||||||
cat <<<$(jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify) >/etc/docker/daemon.json
|
if ! jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify > "$TEMP_FILE"; then
|
||||||
|
echo "Error merging JSON files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mv "$TEMP_FILE" /etc/docker/daemon.json
|
||||||
|
|
||||||
if [ -s /etc/docker/daemon.json.original-$DATE ]; then
|
if [ -s /etc/docker/daemon.json.original-"$DATE" ]; then
|
||||||
DIFF=$(diff <(jq --sort-keys . /etc/docker/daemon.json) <(jq --sort-keys . /etc/docker/daemon.json.original-$DATE))
|
DIFF=$(diff <(jq --sort-keys . /etc/docker/daemon.json) <(jq --sort-keys . /etc/docker/daemon.json.original-"$DATE"))
|
||||||
if [ "$DIFF" != "" ]; then
|
if [ "$DIFF" != "" ]; then
|
||||||
echo "Docker configuration updated, restart docker daemon..."
|
echo "Docker configuration updated, restart docker daemon..."
|
||||||
systemctl restart docker
|
systemctl restart docker
|
||||||
@ -167,11 +173,11 @@ if [ ! -f ~/.ssh/authorized_keys ]; then
|
|||||||
addSshKey
|
addSshKey
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(grep -w "root@coolify" ~/.ssh/authorized_keys)" ]; then
|
if ! grep -qw "root@coolify" ~/.ssh/authorized_keys; then
|
||||||
addSshKey
|
addSshKey
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bash /data/coolify/source/upgrade.sh ${LATEST_VERSION:-latest}
|
bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}"
|
||||||
|
|
||||||
echo -e "\nCongratulations! Your Coolify instance is ready to use.\n"
|
echo -e "\nCongratulations! Your Coolify instance is ready to use.\n"
|
||||||
echo "Please visit http://$(curl -4s https://ifconfig.io):8000 to get started."
|
echo "Please visit http://$(curl -4s https://ifconfig.io):8000 to get started."
|
||||||
|
Loading…
Reference in New Issue
Block a user