28 lines
799 B
Python
28 lines
799 B
Python
#!/usr/bin/python3 -u
|
|
|
|
# A script for install pzoo user
|
|
|
|
from subprocess import call
|
|
from time import sleep
|
|
import distro
|
|
|
|
linux_distro=distro.id()
|
|
|
|
print('{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Upgrading server..."}')
|
|
|
|
sleep(1)
|
|
|
|
if linux_distro=='arch':
|
|
|
|
if call("sudo pacman -Syu --noconfirm", shell=True) > 0:
|
|
print('Error, cannot upgrade server...')
|
|
exit(1)
|
|
elif linux_distro=='debian':
|
|
|
|
if call('sudo DEBIAN_FRONTEND="noninteractive" apt-get -y update', shell=True) > 0:
|
|
print('Error, cannot upgrade server...')
|
|
exit(1)
|
|
|
|
if call('sudo DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade', shell=True) > 0:
|
|
print('Error, cannot upgrade server...')
|
|
exit(1)
|