Skip to content

Commit

Permalink
fix: retab shell script to use space for indent consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDaveHello committed Jul 4, 2018
1 parent 319fa0d commit e3b4327
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 220 deletions.
8 changes: 4 additions & 4 deletions packager/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
set -e

adduser --quiet --system \
--group --home /etc/pm2 \
--gecos "PM2 Process Manager" pm2
--group --home /etc/pm2 \
--gecos "PM2 Process Manager" pm2

if hash systemctl 2> /dev/null; then
{
systemctl enable "pm2.service" && \
systemctl start "pm2.service"
systemctl enable "pm2.service" && \
systemctl start "pm2.service"
} || echo "pm2 could not be registered or started"
elif hash service 2> /dev/null; then
service "pm2" start || echo "pm2 could not be registered or started"
Expand Down
4 changes: 2 additions & 2 deletions packager/debian/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

if hash systemctl 2> /dev/null; then
systemctl disable "pm2.service" && \
systemctl stop "pm2.service" || \
echo "pm2 wasn't even running!"
systemctl stop "pm2.service" || \
echo "pm2 wasn't even running!"
elif hash service 2> /dev/null; then
service "pm2" stop || echo "pm2 wasn't even running!"
else
Expand Down
8 changes: 4 additions & 4 deletions packager/rhel/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ set -e
mkdir -p /etc/pm2

adduser --system \
--home-dir /etc/pm2 \
--comment "PM2 Process Manager" pm2
--home-dir /etc/pm2 \
--comment "PM2 Process Manager" pm2

chown -R pm2:pm2 /etc/pm2

if hash systemctl 2> /dev/null; then
{
systemctl enable "pm2.service" && \
systemctl start "pm2.service"
systemctl enable "pm2.service" && \
systemctl start "pm2.service"
} || echo "pm2 could not be registered or started"
elif hash service 2> /dev/null; then
service "pm2" start || echo "pm2 could not be registered or started"
Expand Down
4 changes: 2 additions & 2 deletions packager/rhel/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

if hash systemctl 2> /dev/null; then
systemctl disable "pm2.service" && \
systemctl stop "pm2.service" || \
echo "pm2 wasn't even running!"
systemctl stop "pm2.service" || \
echo "pm2 wasn't even running!"
elif hash service 2> /dev/null; then
service "pm2" stop || echo "pm2 wasn't even running!"
else
Expand Down
174 changes: 87 additions & 87 deletions packager/setup.deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,85 +33,85 @@ gpg_check ()
{
echo "Checking for gpg..."
if command -v gpg > /dev/null; then
echo "Detected gpg..."
echo "Detected gpg..."
else
echo "Installing gnupg for GPG verification..."
apt-get install -y gnupg
if [ "$?" -ne "0" ]; then
echo "Unable to install GPG! Your base system has a problem; please check your default OS's package repositories because GPG should work."
echo "Repository installation aborted."
exit 1
fi
echo "Installing gnupg for GPG verification..."
apt-get install -y gnupg
if [ "$?" -ne "0" ]; then
echo "Unable to install GPG! Your base system has a problem; please check your default OS's package repositories because GPG should work."
echo "Repository installation aborted."
exit 1
fi
fi
}

curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
echo "Detected curl..."
else
echo "Installing curl..."
apt-get install -q -y curl
if [ "$?" -ne "0" ]; then
echo "Unable to install curl! Your base system has a problem; please check your default OS's package repositories because curl should work."
echo "Repository installation aborted."
exit 1
fi
echo "Installing curl..."
apt-get install -q -y curl
if [ "$?" -ne "0" ]; then
echo "Unable to install curl! Your base system has a problem; please check your default OS's package repositories because curl should work."
echo "Repository installation aborted."
exit 1
fi
fi
}

install_debian_keyring ()
{
if [ "${os}" = "debian" ]; then
echo "Installing debian-archive-keyring which is needed for installing "
echo "apt-transport-https on many Debian systems."
apt-get install -y debian-archive-keyring &> /dev/null
echo "Installing debian-archive-keyring which is needed for installing "
echo "apt-transport-https on many Debian systems."
apt-get install -y debian-archive-keyring &> /dev/null
fi
}


detect_os ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release

if [ "${ID}" = "raspbian" ]; then
os=${ID}
dist=`cut --delimiter='.' -f1 /etc/debian_version`
else
os=${DISTRIB_ID}
dist=${DISTRIB_CODENAME}

if [ -z "$dist" ]; then
dist=${DISTRIB_RELEASE}
fi
fi

elif [ `which lsb_release 2>/dev/null` ]; then
dist=`lsb_release -c | cut -f2`
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`

elif [ -e /etc/debian_version ]; then
# some Debians have jessie/sid in their /etc/debian_version
# while others have '6.0.7'
os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
if grep -q '/' /etc/debian_version; then
dist=`cut --delimiter='/' -f1 /etc/debian_version`
else
dist=`cut --delimiter='.' -f1 /etc/debian_version`
fi

else
unknown_os
fi
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release

if [ "${ID}" = "raspbian" ]; then
os=${ID}
dist=`cut --delimiter='.' -f1 /etc/debian_version`
else
os=${DISTRIB_ID}
dist=${DISTRIB_CODENAME}

if [ -z "$dist" ]; then
dist=${DISTRIB_RELEASE}
fi
fi

elif [ `which lsb_release 2>/dev/null` ]; then
dist=`lsb_release -c | cut -f2`
os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`

elif [ -e /etc/debian_version ]; then
# some Debians have jessie/sid in their /etc/debian_version
# while others have '6.0.7'
os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
if grep -q '/' /etc/debian_version; then
dist=`cut --delimiter='/' -f1 /etc/debian_version`
else
dist=`cut --delimiter='.' -f1 /etc/debian_version`
fi

else
unknown_os
fi
fi

if [ -z "$dist" ]; then
unknown_os
unknown_os
fi

# remove whitespace from OS and dist name
Expand Down Expand Up @@ -164,31 +164,31 @@ main ()
curl_exit_code=$?

if [ "$curl_exit_code" = "22" ]; then
echo "This script is unable to download the repository definition."
echo
[ -e $apt_source_path ] && rm $apt_source_path
unknown_os
echo "This script is unable to download the repository definition."
echo
[ -e $apt_source_path ] && rm $apt_source_path
unknown_os
elif [ "$curl_exit_code" = "35" -o "$curl_exit_code" = "60" ]; then
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${apt_config_url}"
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact support@packagecloud.io with information about your system for help."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
echo "curl is unable to connect to packagecloud.io over TLS when running: "
echo " curl ${apt_config_url}"
echo "This is usually due to one of two things:"
echo
echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
echo
echo "Contact support@packagecloud.io with information about your system for help."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
elif [ "$curl_exit_code" -gt "0" ]; then
echo
echo "Unable to run: "
echo " curl ${apt_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
echo
echo "Unable to run: "
echo " curl ${apt_config_url}"
echo
echo "Double check your curl installation and try again."
[ -e $apt_source_path ] && rm $apt_source_path
exit 1
else
echo "done."
echo "done."
fi

echo -n "Importing packagecloud gpg key... "
Expand All @@ -207,21 +207,21 @@ main ()

CURR_USER=$SUDO_USER
if [ "$CURR_USER" == "" ]; then
CURR_USER=$USER
CURR_USER=$USER
fi

if [ "$CURR_USER" == "root" ] || [ "$CURR_USER" == "" ]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "WARNING: You are either running this script as root or the"
echo " \$USER variable is empty. In order to have a"
echo " working PM2 installation, you need to add your"
echo " user in the pm2 group using the following"
echo " command: usermod -aG pm2 <username>"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "WARNING: You are either running this script as root or the"
echo " \$USER variable is empty. In order to have a"
echo " working PM2 installation, you need to add your"
echo " user in the pm2 group using the following"
echo " command: usermod -aG pm2 <username>"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
else
echo -n "Adding $CURR_USER to group pm2..."
usermod -aG pm2 $CURR_USER
echo "done."
echo -n "Adding $CURR_USER to group pm2..."
usermod -aG pm2 $CURR_USER
echo "done."
fi
echo
echo "Installation done."
Expand Down
Loading

0 comments on commit e3b4327

Please sign in to comment.