moved into main repo for pisi 2.0
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, re
|
||||
import shutil
|
||||
|
||||
OUR_ID = 794
|
||||
OUR_NAME = "mysql"
|
||||
OUR_DESC = "mysql"
|
||||
|
||||
DATADIR = "/var/lib/mysql"
|
||||
DATADIRMODE = 0755
|
||||
|
||||
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
|
||||
try:
|
||||
os.system ("groupadd -g %d %s" % (OUR_ID, OUR_NAME))
|
||||
os.system ("useradd -m -d /var/lib/mysql -r -s /bin/false -u %d -g %d %s -c %s" % (OUR_ID, OUR_ID, OUR_NAME, OUR_DESC))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
os.system("/sbin/mudur_tmpfiles.py /usr/lib/tmpfiles.d/mariadb.conf")
|
||||
|
||||
# Create the database
|
||||
os.system("/bin/chown -R mysql:mysql %s" % DATADIR)
|
||||
os.system("/bin/chown -R mysql:mysql /var/log/mysqld.log")
|
||||
os.system("/usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql --basedir=/usr --force")
|
||||
os.system("/usr/bin/mysql_upgrade --force")
|
||||
|
||||
# On first install...
|
||||
if not os.path.exists(DATADIR):
|
||||
os.makedirs(DATADIR, DATADIRMODE)
|
||||
|
||||
|
||||
def postRemove():
|
||||
try:
|
||||
os.system ("userdel %s" % OUR_NAME)
|
||||
os.system ("groupdel %s" % OUR_NAME)
|
||||
except:
|
||||
pass
|
||||
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from comar.service import *
|
||||
import os
|
||||
|
||||
serviceType="server"
|
||||
serviceDesc=_({"en": "MariaDB Database Server",
|
||||
"tr": "MariaDB Veritabanı Sunucusu"})
|
||||
|
||||
PIDFILE="/run/mysqld/mysqld.pid"
|
||||
DAEMON="/usr/bin/mysqld"
|
||||
|
||||
@synchronized
|
||||
def start():
|
||||
startService(command=DAEMON,
|
||||
pidfile=PIDFILE,
|
||||
detach=True,
|
||||
donotify=True)
|
||||
#os.system("pidof mariadb_server + /usr/bin/mysqld > /run/mysqld/mysqld.pid")
|
||||
|
||||
|
||||
@synchronized
|
||||
def stop():
|
||||
stopService(pidfile=PIDFILE,
|
||||
donotify=True)
|
||||
|
||||
try:
|
||||
os.unlink(PIDFILE)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def status():
|
||||
return isServiceRunning(PIDFILE)
|
||||
Reference in New Issue
Block a user