From: Guillaume Pellerin Date: Wed, 20 Jan 2016 18:53:02 +0000 (+0100) Subject: rename install script X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=383bdb30c8055a562331cb12905dea4beffd326e;p=mezzo.git rename install script --- diff --git a/install_linux_systemd.py b/install_linux_systemd.py new file mode 100755 index 00000000..c16df44a --- /dev/null +++ b/install_linux_systemd.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + +import os + +path = os.getcwd() +name = path.split(os.sep)[-1] +service = '/lib/systemd/system/' + name + '.service' + +print 'installing ' + name + '...' + +if not os.path.exists('/etc/init.d/docker'): + os.system('wget -qO- https://get.docker.com/ | sh') + os.system('pip install docker-compose') + +rules=""" +[Unit] +Description=%s composition +Requires=docker.service +After=docker.service + +[Service] +ExecStart=/usr/local/bin/docker-compose -f %s/docker-compose.yml up -d +ExecStop=/usr/local/bin/docker-compose -f %s/docker-compose.yml stop + +[Install] +WantedBy=local.target +""" % (name, path, path) + +# print rules + +f = open(service, 'w') +f.write(rules) +f.close() + +os.system('systemctl enable ' + service) +os.system('systemctl daemon-reload') +os.system('systemctl start ' + name) + +print 'done' diff --git a/install_linux_sysvinit.py b/install_linux_sysvinit.py new file mode 100755 index 00000000..8c2cf178 --- /dev/null +++ b/install_linux_sysvinit.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import os + +path = os.getcwd() +name = path.split(os.sep)[-1].lower() +service = '/etc/init.d/' + name +conf = path + os.sep + 'docker-compose.yml' + +print 'installing ' + name + '...' + +if not os.path.exists('/etc/init.d/docker'): + os.system('wget -qO- https://get.docker.com/ | sh') + os.system('pip install docker-compose') + +f = open('init.sh.example', 'r') +rules = f.read() % (name, name, conf) +f.close() + +f = open(service, 'w') +f.write(rules) +f.close() + +os.system('chmod 755 ' + service) +os.system('update-rc.d ' + name + ' defaults') + +print 'done' diff --git a/install_systemd.py b/install_systemd.py deleted file mode 100755 index c16df44a..00000000 --- a/install_systemd.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python - -import os - -path = os.getcwd() -name = path.split(os.sep)[-1] -service = '/lib/systemd/system/' + name + '.service' - -print 'installing ' + name + '...' - -if not os.path.exists('/etc/init.d/docker'): - os.system('wget -qO- https://get.docker.com/ | sh') - os.system('pip install docker-compose') - -rules=""" -[Unit] -Description=%s composition -Requires=docker.service -After=docker.service - -[Service] -ExecStart=/usr/local/bin/docker-compose -f %s/docker-compose.yml up -d -ExecStop=/usr/local/bin/docker-compose -f %s/docker-compose.yml stop - -[Install] -WantedBy=local.target -""" % (name, path, path) - -# print rules - -f = open(service, 'w') -f.write(rules) -f.close() - -os.system('systemctl enable ' + service) -os.system('systemctl daemon-reload') -os.system('systemctl start ' + name) - -print 'done' diff --git a/install_sysv.py b/install_sysv.py deleted file mode 100755 index 8c2cf178..00000000 --- a/install_sysv.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python - -import os - -path = os.getcwd() -name = path.split(os.sep)[-1].lower() -service = '/etc/init.d/' + name -conf = path + os.sep + 'docker-compose.yml' - -print 'installing ' + name + '...' - -if not os.path.exists('/etc/init.d/docker'): - os.system('wget -qO- https://get.docker.com/ | sh') - os.system('pip install docker-compose') - -f = open('init.sh.example', 'r') -rules = f.read() % (name, name, conf) -f.close() - -f = open(service, 'w') -f.write(rules) -f.close() - -os.system('chmod 755 ' + service) -os.system('update-rc.d ' + name + ' defaults') - -print 'done'