mirror of https://gitee.com/bigwinds/arangodb
fix systemd issues when reinstalling a package
This commit is contained in:
parent
b3c3106507
commit
77fb3f777e
|
@ -69,7 +69,7 @@ ar_exitcode_num_to_string(){
|
||||||
local found=false
|
local found=false
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
while IFS=',' read code num _ ; do
|
while IFS=',' read code num _ ; do
|
||||||
if [ "$in" == "$num" ]; then
|
if [ "$in" = "$num" ]; then
|
||||||
echo $code
|
echo $code
|
||||||
found=true
|
found=true
|
||||||
break
|
break
|
||||||
|
@ -86,14 +86,14 @@ ar_exitcode_num_to_string(){
|
||||||
|
|
||||||
ar_exitcode_num_to_message(){
|
ar_exitcode_num_to_message(){
|
||||||
local in="$1"
|
local in="$1"
|
||||||
if [[ $in == "0" ]]; then
|
if [ $in = "0" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local file="$ARANGO_ERROR_CODES_DAT"
|
local file="$ARANGO_ERROR_CODES_DAT"
|
||||||
local found=false
|
local found=false
|
||||||
if [ -f $file ]; then
|
if [ -f $file ]; then
|
||||||
while IFS=',' read code num message long_message; do
|
while IFS=',' read code num message long_message; do
|
||||||
if [ "$in" == "$num" ]; then
|
if [ "$in" = "$num" ]; then
|
||||||
echo "$message"
|
echo "$message"
|
||||||
found=true
|
found=true
|
||||||
break
|
break
|
||||||
|
@ -114,7 +114,7 @@ ar_exitcode_string_to_num(){
|
||||||
if [ -f $file ]; then
|
if [ -f $file ]; then
|
||||||
in="$1"
|
in="$1"
|
||||||
while IFS=',' read code num _ ; do
|
while IFS=',' read code num _ ; do
|
||||||
if [ "$in" == "$code" ]; then
|
if [ "$in" = "$code" ]; then
|
||||||
echo $num
|
echo $num
|
||||||
found=true
|
found=true
|
||||||
break
|
break
|
||||||
|
@ -131,9 +131,9 @@ ar_exitcode_string_to_num(){
|
||||||
|
|
||||||
ar_exit_by_num(){
|
ar_exit_by_num(){
|
||||||
local code="$1"
|
local code="$1"
|
||||||
local str="$(ar_exitcode_num_to_string $code)"
|
|
||||||
local msg="$(ar_exitcode_num_to_message $code)"
|
|
||||||
if [ $code -ne 0 ]; then
|
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
|
echo "FATAL ERROR: $str - $msg" 1>&2
|
||||||
exit "$code"
|
exit "$code"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
action="$1"
|
action="$1"
|
||||||
|
old_version="$2"
|
||||||
|
|
||||||
ARANGODB="/usr/sbin/arangod"
|
ARANGODB="/usr/sbin/arangod"
|
||||||
|
|
||||||
|
@ -9,7 +10,6 @@ ARANGODB="/usr/sbin/arangod"
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
. /usr/share/arangodb3/arangodb-helper
|
. /usr/share/arangodb3/arangodb-helper
|
||||||
|
|
||||||
set +x
|
|
||||||
db_get @CPACK_PACKAGE_NAME@/storage_engine
|
db_get @CPACK_PACKAGE_NAME@/storage_engine
|
||||||
STORAGE_ENGINE=$RET
|
STORAGE_ENGINE=$RET
|
||||||
export GLIBCXX_FORCE_NEW=1
|
export GLIBCXX_FORCE_NEW=1
|
||||||
|
@ -19,10 +19,20 @@ if test -d /var/lib/arangodb3 -a ! -f /usr/sbin/arangod; then
|
||||||
else
|
else
|
||||||
NEW_INSTALL_EXISTING_DIR=false
|
NEW_INSTALL_EXISTING_DIR=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#fill in correct storage engine into arangod.conf
|
#fill in correct storage engine into arangod.conf
|
||||||
sed -i /etc/arangodb3/arangod.conf -e "s;storage-engine = auto;storage-engine = $STORAGE_ENGINE;"
|
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 \
|
if test "$action" = "configure" -a \
|
||||||
-z "$2" -a \
|
-z "$2" -a \
|
||||||
|
@ -56,7 +66,7 @@ set -e
|
||||||
if [ $exit_status -eq "$(ar_exitcode_string_to_num EXIT_UPGRADE_REQUIRED)" ]; then
|
if [ $exit_status -eq "$(ar_exitcode_string_to_num EXIT_UPGRADE_REQUIRED)" ]; then
|
||||||
UPGRADE=true
|
UPGRADE=true
|
||||||
else
|
else
|
||||||
ar_ferr $exit_status
|
ar_exit_by_num $exit_status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue