build: stop at any error

This commit is contained in:
nachoparker 2019-01-09 21:56:05 -07:00
parent 2e7da45f68
commit 9de1f51a3d
6 changed files with 23 additions and 20 deletions

View File

@ -20,25 +20,23 @@
[[ -f /.ncp-image ]] || cd "$TMPDIR" # update locally during build
echo -e "Performing updates"
./update.sh && {
./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
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"
# 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

View File

@ -36,6 +36,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/100dnsmasq
}
return 0
}
configure()

View File

@ -37,6 +37,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/009letsencrypt
}
return 0
}
# tested with certbot 0.10.2

View File

@ -69,6 +69,7 @@ exit 0
EOF
chmod +x /etc/services-available.d/100noip
}
return 0
}
configure()

View File

@ -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()

View File

@ -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
}
@ -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"
}