error codes
This commit is contained in:
parent
1b919a5c10
commit
56dfa71a62
@ -51,7 +51,7 @@ case "$1" in
|
|||||||
mkdir -p $SEAF/conf
|
mkdir -p $SEAF/conf
|
||||||
cp /etc/seafile/* $SEAF/conf/* -rf
|
cp /etc/seafile/* $SEAF/conf/* -rf
|
||||||
$0 run-upgrade
|
$0 run-upgrade
|
||||||
exit
|
exit $?
|
||||||
else
|
else
|
||||||
patch_seahub_conf
|
patch_seahub_conf
|
||||||
for CMD in "${COMMANDS[@]}"; do
|
for CMD in "${COMMANDS[@]}"; do
|
||||||
@ -81,6 +81,10 @@ case "$1" in
|
|||||||
run-upgrade)
|
run-upgrade)
|
||||||
$0 upgrade
|
$0 upgrade
|
||||||
RES=$?
|
RES=$?
|
||||||
|
if [ $RES -eq 1 ]; then
|
||||||
|
echo "Failed upgrade"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [ $RES -eq 127 ]; then
|
if [ $RES -eq 127 ]; then
|
||||||
#No upgrade
|
#No upgrade
|
||||||
true
|
true
|
||||||
@ -109,6 +113,22 @@ case "$1" in
|
|||||||
/usr/local/sbin/upgrade main
|
/usr/local/sbin/upgrade main
|
||||||
kill -SIGHUP $(pgrep -o nginx) #Reload nginx
|
kill -SIGHUP $(pgrep -o nginx) #Reload nginx
|
||||||
;;
|
;;
|
||||||
|
maintanance)
|
||||||
|
$0 stop
|
||||||
|
$LATEST/seaf-gc.sh
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
setup)
|
||||||
|
INSTALLDIR=$2
|
||||||
|
SETUP_ARGS="auto -n ${SEAF_NAME:-$(hostname)} -i $(hostname) -p 8082"
|
||||||
|
if [ ! -z "$SEAF_MYSQL" ]; then
|
||||||
|
$INSTALLDIR/setup-seafile-mysql.sh $SETUP_ARGS -o $SEAF_MYSQL_HOST -t ${SEAF_MYSQL_PORT:-3306} -u "${SEAF_MYSQL_USER:-root}" \
|
||||||
|
-w "$SEAF_MYSQL_PASS" -r "${SEAF_MYSQL_ROOT_PASS:-$SEAF_MYSQL_PASS}" -c ${SEAF_MYSQL_DB_CCNET:-ccnet} -s ${SEAF_MYSQL_DB_SEAF:-seafile} \
|
||||||
|
-b ${SEAF_MYSQL_DB_HUB:-seahub}
|
||||||
|
else
|
||||||
|
$INSTALLDIR/setup-seafile.sh $SETUP_ARGS
|
||||||
|
fi
|
||||||
|
;;
|
||||||
status)
|
status)
|
||||||
RUNNING=1
|
RUNNING=1
|
||||||
for CMD in seafile-controller ccnet "${COMMANDS[@]}"; do
|
for CMD in seafile-controller ccnet "${COMMANDS[@]}"; do
|
||||||
|
@ -57,11 +57,11 @@ def perform_upgrade_command(version,mysql=False,yes=True):
|
|||||||
target = map(lambda x: int(x), version.split("."))
|
target = map(lambda x: int(x), version.split("."))
|
||||||
print len(current) == 1 and current[0] == 0
|
print len(current) == 1 and current[0] == 0
|
||||||
if len(current) == 1 and current[0] == 0: #Not installed
|
if len(current) == 1 and current[0] == 0: #Not installed
|
||||||
print("Running installer, please don't change any default values regarding ports.")
|
print("Running installer.")
|
||||||
installer = os.path.join(seaf_home,"seafile-server-%s" % version,"setup-seafile%s.sh" % ("-mysql" if mysql else ""))
|
installer = os.path.join(seaf_home,"seafile-server-%s" % version,"setup-seafile%s.sh" % ("-mysql" if mysql else ""))
|
||||||
while not call(["sh","-c",installer],stdout=sys.stdout, stdin=sys.stdin):
|
if not call(["seafile-server","setup"],stdout=sys.stdout, stdin=sys.stdin):
|
||||||
pass
|
sys.exit(1)
|
||||||
return 0
|
sys.exit(126)
|
||||||
script_re = "^upgrade_(\d+).(\d+)_(\d+).(\d+)\.sh$"
|
script_re = "^upgrade_(\d+).(\d+)_(\d+).(\d+)\.sh$"
|
||||||
run = []
|
run = []
|
||||||
last = None
|
last = None
|
||||||
@ -114,15 +114,15 @@ def main_command(version="latest",page="https://www.seafile.com/en/download/"):
|
|||||||
install = dict(avail.items())[version]
|
install = dict(avail.items())[version]
|
||||||
if version_int(current_version()) == version_int(version):
|
if version_int(current_version()) == version_int(version):
|
||||||
print("%s(%s) is already installed" % (version,version_int(version)))
|
print("%s(%s) is already installed" % (version,version_int(version)))
|
||||||
return 1
|
sys.exit(126)
|
||||||
if version in installed_versions():
|
if version in installed_versions():
|
||||||
return perform_upgrade_command(version)
|
return perform_upgrade_command(version)
|
||||||
if install:
|
if install:
|
||||||
print("Installing: %s" % version)
|
print("Installing: %s" % version)
|
||||||
return install_command(install)
|
sys.exit(install_command(install))
|
||||||
else:
|
else:
|
||||||
print("Couldn't determine download for %s" % version)
|
print("Couldn't determine download for %s" % version)
|
||||||
return 1
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import scriptine
|
import scriptine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user