Skip to content

Commit

Permalink
Merge pull request #137 from BlankOn/update-installer-sh
Browse files Browse the repository at this point in the history
[samsul] update install.sh
  • Loading branch information
samsulmaarif authored Apr 20, 2021
2 parents bf128f7 + 8ab10f6 commit e4ac931
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

# stop when error
set -e

DIST=$(cat /etc/*release | grep "^ID=" | cut -d '=' -f 2)

# Require sudo or root privilege
Expand All @@ -12,6 +15,15 @@ TEMP_PATH=/tmp
DEV_INSTALL=0

apt update

# Check if docker is installed
if [[ -x "$(command -v docker)" && $(docker --version) ]]; then
echo "Docker installed [OK]"
else
echo "Installing docker"
apt install -y docker.io
fi

apt install -y gnupg pbuilder debootstrap devscripts debhelper python-apt reprepro jq

if [ -f ./target/release.tar.gz ]; then
Expand All @@ -25,10 +37,10 @@ else
echo "$DOWNLOAD_URL"
rm -f $TEMP_PATH/release.tar.gz && cd $TEMP_PATH && curl -L -f -o ./release.tar.gz $DOWNLOAD_URL
if test $? -gt 0; then
echo "Downloding [FAILED]"
echo "Downloading [FAILED]"
exit 1
fi
echo "Downloding [OK]"
echo "Downloading [OK]"
echo
fi

Expand All @@ -39,20 +51,22 @@ rm -rf irgsh-go && tar -xf release.tar.gz
echo "Extracting [OK]"
echo

# Stop any existing instances
echo "Stopping existing instance(s) ... "
systemctl daemon-reload
/etc/init.d/irgsh-chief stop || true
/etc/init.d/irgsh-builder stop || true
/etc/init.d/irgsh-repo stop || true
systemctl stop irgsh-chief
systemctl stop irgsh-builder
systemctl stop irgsh-repo
killall irgsh-chief || true
killall irgsh-builder || true
killall irgsh-repo || true
echo "Stopping existing instance(s) [OK]"
echo
# Stop any existing instances if installed
if [ -x "$(command -v irgsh-chief )" ]; then
echo "Stopping existing instance(s) ... "
systemctl daemon-reload
/etc/init.d/irgsh-chief stop || true
/etc/init.d/irgsh-builder stop || true
/etc/init.d/irgsh-repo stop || true
systemctl stop irgsh-chief
systemctl stop irgsh-builder
systemctl stop irgsh-repo
killall irgsh-chief || true
killall irgsh-builder || true
killall irgsh-repo || true
echo "Stopping existing instance(s) [OK]"
echo
fi

if [ $DEV_INSTALL = 1 ]; then
# For development/testing purpose
Expand Down Expand Up @@ -87,7 +101,7 @@ if [ ! -f "/etc/irgsh/config.yml" ]; then
cp -v $TEMP_PATH/irgsh-go/etc/irgsh/config.yml /etc/irgsh/config.yml
fi
# irgsh user
groupadd irgsh || true
#groupadd irgsh || true
if getent passwd irgsh >/dev/null 2>&1; then
echo "irgsh user is already exists"
else
Expand All @@ -97,7 +111,7 @@ else
usermod -aG docker irgsh
echo "irgsh user added to system"
fi
usermod -aG irgsh irgsh
#usermod -aG irgsh irgsh
echo "Installing files [OK]"
echo

Expand Down

0 comments on commit e4ac931

Please sign in to comment.