root/ThETa/install_theta.py @ 8fd1d584
2e0a7cb1 | Sylvain L. Sauvage | #!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|||
#
|
|||
# This program is a part of the IoTa project.
|
|||
#
|
|||
# Copyright © 2012 Université de Caen Basse-Normandie, GREYC
|
|||
#
|
|||
# This program is free software: you can redistribute it and/or modify
|
|||
# it under the terms of the GNU General Public License as published by
|
|||
# the Free Software Foundation, either version 3 of the License, or
|
|||
# (at your option) any later version.
|
|||
#
|
|||
# This program is distributed in the hope that it will be useful,
|
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
# GNU General Public License for more details.
|
|||
# <http://www.gnu.org/licenses/>
|
|||
#
|
|||
# See AUTHORS for a list of contributors.
|
|||
#
|
|||
import os
|
|||
import sys
|
|||
import lib.utils
|
|||
from lib.config import CONFIG
|
|||
import lib.installer
|
|||
class ThETaInstaller(lib.installer.Installer):
|
|||
def __init__(self):
|
|||
lib.installer.Installer.__init__(self, "ThETa", "theta", [
|
|||
("Enter RHO (REST/HTTP Object JSON interface) URL", "theta", "rho_url", {}),
|
|||
96454bcd | Sylvain L. Sauvage | ("Enter your identity", "theta", "identity", {}),
|
|
("Enter the EPC code", "theta", "epc", {}),
|
|||
2e0a7cb1 | Sylvain L. Sauvage | ("Enter the CSV file for readpoints lat/lon path", "theta", "csv_repo", {"type": "file"}),
|
|
("Enter the archive file path", "theta", "repo", {"type": "file"}),
|
|||
("Enter the path where you want to unpack it", "theta", "directory",
|
|||
{"type": "path"}),
|
|||
("Enter the name of the directory", "theta", "name", {})
|
|||
], [
|
|||
("theta",
|
|||
96454bcd | Sylvain L. Sauvage | { "IoTa.sortDataStorage.ds1.ds.csvFile": ("theta", "csv_file"),
|
|
2e0a7cb1 | Sylvain L. Sauvage | "IoTa.sortDataStorage.ds0.url": ("theta", "rho_url_epc"),
|
|
})
|
|||
])
|
|||
def postConfigure(self):
|
|||
96454bcd | Sylvain L. Sauvage | self.cset("rho_url_epc", self.cget("rho_url") + "?theta=true&id=" + self.cget("identity") + "&epc=" + self.cget("epc"))
|
|
self.cset("csv_file", self.cget("directory") + self.cget("name") + "/" + "readpoints.csv")
|
|||
2e0a7cb1 | Sylvain L. Sauvage | ||
def postUnpack(self):
|
|||
96454bcd | Sylvain L. Sauvage | theta_dir = self.cget("directory") + self.cget("name")
|
|
2e0a7cb1 | Sylvain L. Sauvage | lib.utils.sh_cp("resources/theta.properties", theta_dir)
|
|
lib.utils.sh_cp("resources/theta.sh", theta_dir)
|
|||
96454bcd | Sylvain L. Sauvage | lib.utils.sh_cp(self.cget("csv_repo"), self.cget("csv_file"))
|
|
2e0a7cb1 | Sylvain L. Sauvage | ||
if __name__ == "__main__":
|
|||
if "--accept-defaults" in sys.argv:
|
|||
CONFIG.set("global", "accept_defaults", "true")
|
|||
lib.utils.putWarning("Installing with defaults values from `resources/install.ini")
|
|||
else:
|
|||
CONFIG.set("global", "accept_defaults", "false")
|
|||
lib.utils.putTitle(" ThETa Installer")
|
|||
ThETaInstaller().run()
|
|||
lib.utils.putWarning(
|
|||
"""
|
|||
Important!
|
|||
`resources/install.ini` contains logins and passwords in _clear text_.
|
|||
They can also be found in the property files of the application.
|
|||
""")
|