Skip to content

Commit

Permalink
build: stop at any error
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jan 10, 2019
1 parent 2e7da45 commit 9de1f51
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
34 changes: 16 additions & 18 deletions bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,23 @@
[[ -f /.ncp-image ]] || cd "$TMPDIR" # update locally during build

echo -e "Performing updates"
./update.sh && {

cd "$TMPDIR"
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format
echo "$VER" > /usr/local/etc/ncp-version
echo "$VER" > /var/run/.ncp-latest-version

# write changelog
git log --graph --oneline --decorate \
--pretty=format:"[%D] %s" --date=short | \
grep 'tag: v' | \
sed '/HEAD ->\|origin/s|\[.*\(tag: v[0-9]\+\.[0-9]\+\.[0-9]\+\).*\]|[\1]|' | \
sed 's|* \[tag: |[|' > /usr/local/etc/ncp-changelog
}
echo -e "NextCloudPi updated to version $VER"
./update.sh || exit 1

cd "$TMPDIR"
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format
echo "$VER" > /usr/local/etc/ncp-version
echo "$VER" > /var/run/.ncp-latest-version

# write changelog
git log --graph --oneline --decorate \
--pretty=format:"[%D] %s" --date=short | \
grep 'tag: v' | \
sed '/HEAD ->\|origin/s|\[.*\(tag: v[0-9]\+\.[0-9]\+\.[0-9]\+\).*\]|[\1]|' | \
sed 's|* \[tag: |[|' > /usr/local/etc/ncp-changelog
}

cd /

exit
echo -e "NextCloudPi updated to version $VER"
exit 0
} # force to read the whole thing into memory, as its contents might change in update.sh
1 change: 1 addition & 0 deletions bin/ncp/NETWORKING/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/100dnsmasq
}
return 0
}

configure()
Expand Down
1 change: 1 addition & 0 deletions bin/ncp/NETWORKING/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/009letsencrypt
}
return 0
}

# tested with certbot 0.10.2
Expand Down
1 change: 1 addition & 0 deletions bin/ncp/NETWORKING/no-ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/100noip
}
return 0
}

configure()
Expand Down
2 changes: 2 additions & 0 deletions bin/ncp/SECURITY/UFW.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ install()

# Disable logging to kernel
grep -q maxsize /etc/logrotate.d/ufw || sed -i /weekly/amaxsize2M /etc/logrotate.d/ufw

return 0
}

configure()
Expand Down
8 changes: 4 additions & 4 deletions bin/ncp/SYSTEM/nc-hdd-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ configure()
}

[[ "$ACTIVE" != yes ]] && {
systemctl disable smartd
systemctl stop smartd
update-rc.d smartd disable
service smartd stop
echo "HDD monitor disabled"
return 0
}
Expand Down Expand Up @@ -58,8 +58,8 @@ EOF
chmod +x /usr/local/etc/ncp-hdd-notif.sh

for dr in "${DRIVES[@]}"; do smartctl --smart=on /dev/${dr} | sed 1,2d; done
systemctl enable smartd
systemctl start smartd
update-rc.d smartd enable
service smartd start
echo "HDD monitor enabled"
}

Expand Down

0 comments on commit 9de1f51

Please sign in to comment.