1
0
Fork 0

fix systemd issues when reinstalling a package

This commit is contained in:
Jan Christoph Uhde 2017-09-01 08:45:49 +02:00
parent b3c3106507
commit 77fb3f777e
2 changed files with 19 additions and 9 deletions

View File

@ -69,7 +69,7 @@ ar_exitcode_num_to_string(){
local found=false
if [ -f "$file" ]; then
while IFS=',' read code num _ ; do
if [ "$in" == "$num" ]; then
if [ "$in" = "$num" ]; then
echo $code
found=true
break
@ -86,14 +86,14 @@ ar_exitcode_num_to_string(){
ar_exitcode_num_to_message(){
local in="$1"
if [[ $in == "0" ]]; then
if [ $in = "0" ]; then
return
fi
local file="$ARANGO_ERROR_CODES_DAT"
local found=false
if [ -f $file ]; then
while IFS=',' read code num message long_message; do
if [ "$in" == "$num" ]; then
if [ "$in" = "$num" ]; then
echo "$message"
found=true
break
@ -114,7 +114,7 @@ ar_exitcode_string_to_num(){
if [ -f $file ]; then
in="$1"
while IFS=',' read code num _ ; do
if [ "$in" == "$code" ]; then
if [ "$in" = "$code" ]; then
echo $num
found=true
break
@ -131,9 +131,9 @@ ar_exitcode_string_to_num(){
ar_exit_by_num(){
local code="$1"
local str="$(ar_exitcode_num_to_string $code)"
local msg="$(ar_exitcode_num_to_message $code)"
if [ $code -ne 0 ]; then
local str="$(ar_exitcode_num_to_string $code)"
local msg="$(ar_exitcode_num_to_message $code)"
echo "FATAL ERROR: $str - $msg" 1>&2
exit "$code"
fi

View File

@ -2,6 +2,7 @@
set -e
action="$1"
old_version="$2"
ARANGODB="/usr/sbin/arangod"
@ -9,7 +10,6 @@ ARANGODB="/usr/sbin/arangod"
. /usr/share/debconf/confmodule
. /usr/share/arangodb3/arangodb-helper
set +x
db_get @CPACK_PACKAGE_NAME@/storage_engine
STORAGE_ENGINE=$RET
export GLIBCXX_FORCE_NEW=1
@ -19,10 +19,20 @@ if test -d /var/lib/arangodb3 -a ! -f /usr/sbin/arangod; then
else
NEW_INSTALL_EXISTING_DIR=false
fi
#fill in correct storage engine into arangod.conf
sed -i /etc/arangodb3/arangod.conf -e "s;storage-engine = auto;storage-engine = $STORAGE_ENGINE;"
if test "@CPACK_SYSTEMD_FOUND@" -eq 1 ; then
if deb-systemd-invoke is-active @CPACK_PACKAGE_NAME@.service 2>&1 >/dev/null ; then
deb-systemd-invoke stop @CPACK_PACKAGE_NAME@.service >/dev/null \
|| ar_err "failed to stop arangodb3 service" $?
fi
else
if [ -x "/etc/init.d/arangodb3" ]; then
invoke-rc.d arangodb3 stop \
|| ar_err "failed to stop arangodb3 service" $?
fi
fi
if test "$action" = "configure" -a \
-z "$2" -a \
@ -56,7 +66,7 @@ set -e
if [ $exit_status -eq "$(ar_exitcode_string_to_num EXIT_UPGRADE_REQUIRED)" ]; then
UPGRADE=true
else
ar_ferr $exit_status
ar_exit_by_num $exit_status
fi