Skip to content

Commit

Permalink
do not rely on pings, just return value of operations
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Feb 8, 2018
1 parent ab86551 commit fc0d3f9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
7 changes: 4 additions & 3 deletions bin/ncp-check-version
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

[ $(id -u) -ne 0 ] && exit 1

ping -W 2 -w 1 -q 4.2.2.2 &>/dev/null || { echo "No internet connectivity"; exit 1; }

rm -rf /tmp/ncp-check-tmp

git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1
git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp {
echo "No internet connectivity"
exit 1
}

cd /tmp/ncp-check-tmp || exit 1
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
Expand Down
6 changes: 4 additions & 2 deletions bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

{
[ "$(id -u)" -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; }
ping -W 2 -w 1 -q 4.2.2.2 &>/dev/null || { echo "No internet connectivity"; exit 1; }
echo -e "Downloading updates"
rm -rf /tmp/ncp-update-tmp
git clone --depth 20 -q https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
git clone --depth 20 -q https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || {
echo "No internet connectivity"
exit 1
}
cd /tmp/ncp-update-tmp

echo -e "Performing updates"
Expand Down
2 changes: 0 additions & 2 deletions etc/nextcloudpi-config.d/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ EOF
# tested with git version v0.11.0-71-g018a304
configure()
{
ping -W 2 -w 1 -q 4.2.2.2 &>/dev/null || { echo "No internet connectivity"; return 1; }

local DOMAIN_LOWERCASE="${DOMAIN_,,}"

grep -q ServerName $VHOSTCFG && \
Expand Down
6 changes: 2 additions & 4 deletions etc/nextcloudpi-config.d/nc-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ install()

configure()
{
ping -W 2 -w 1 -q 4.2.2.2 &>/dev/null || { echo "No internet connectivity"; return 1; }

## IF BETA SELECTED ADD "pre" to DOWNLOAD PATH
[[ "$BETA_" == yes ]] && local PREFIX="pre"

Expand Down Expand Up @@ -160,7 +158,7 @@ configure()
fi

# wait for mariadb
pgrep -x mysqld &>/dev/null || { echo "mariaDB process not found"; return 1; }
pgrep -x mysqld &>/dev/null || echo "mariaDB process not found"

while :; do
[[ -S /var/run/mysqld/mysqld.sock ]] && break
Expand All @@ -184,6 +182,7 @@ EXIT
EOF

## SET APACHE VHOST
echo "Setting up Apache..."
cat > /etc/apache2/sites-available/nextcloud.conf <<'EOF'
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
Expand All @@ -206,7 +205,6 @@ EOF
</IfModule>
EOF
a2ensite nextcloud
echo "Setting up Apache..."

cat > /etc/apache2/sites-available/000-default.conf <<'EOF'
<VirtualHost _default_:80>
Expand Down
2 changes: 0 additions & 2 deletions etc/nextcloudpi-config.d/no-ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ configure()
service noip2 stop
[[ $ACTIVE_ != "yes" ]] && { update-rc.d noip2 disable; return 0; }

ping -W 2 -w 1 -q 4.2.2.2 &>/dev/null || { echo "No internet connectivity"; return 1; echo "noip DDNS disabled"; }

local IF=$( ip -br l | awk '{ if ( $2 == "UP" ) print $1 }' | head -1 )
[[ "$IF" != "" ]] && IF="-I $IF"

Expand Down

0 comments on commit fc0d3f9

Please sign in to comment.