Commit a4cee9d8 by Szeberényi Imre

Linux install fix

parent 0fe9b30d
...@@ -8,25 +8,31 @@ VM kontextualizálását végzi ...@@ -8,25 +8,31 @@ VM kontextualizálását végzi
- /usr/bin/vm_renewal - /usr/bin/vm_renewal
- /etc/systemd/system/agent.service - /etc/systemd/system/agent.service
### tesztelve *** ### tesztelve ###
- ubuntu 18.04, 20.04, 22.04, 24.04 - ubuntu 18.04, 20.04, 22.04, 24.04
- vannak más és régebbi rednszerekhez is alkatrészek a repóban, de feledésbe merültek... - vannak más és régebbi rendszerekhez is alkatrészek a repóban, de feledésbe merültek...
### Linux install ### ### Linux install ###
* Feltételezzuk, hogy van python3 és virtualenv, ha nincs: * Feltételezzük, hogy van *git*, *python3*, *virtualenv* és *ifupdown*, ha nincs:
- sudo apt install git
- sudo apt install python3 - sudo apt install python3
- sudp apt install virtualenvwrapper - sudo apt install virtualenvwrapper
* sudo -i - sudo apt install ifupdown # elvileg együtt tud élni a Network Managerrel
* cd /root * Majd:
* chmod oug+x . ```
* mkvirtualenv agent sudo -i
* workon agent cd /root
* git clone https://git.ik.bme.hu/CIRCLE3/agent.git chmod oug+x . # fontos a pont!
* chmod oug+rx agent mkvirtualenv agent
* cd agent workon agent
* python agent.py --install git clone https://git.ik.bme.hu/CIRCLE3/agent.git
- bemasolja az agent.service-t /etc/systemd -be, engedélyezi, de nem indítja el chmod oug+rx agent
- bemasolja a vm_renewal-t a /usr/bin/ -be cd agent
python agent.py --install
```
* Ez utóbbi parancs
- bemásolja az agent.service-t /etc/systemd/system -be, engedélyezi, de nem indítja el
- bemásolja a vm_renewal-t a /usr/bin/ -be
## Windows ## ## Windows ##
* Bundled python alkalmazások, melyekből az első kettő szervízként fut, a harmadik a clud user belépésekor indul * Bundled python alkalmazások, melyekből az első kettő szervízként fut, a harmadik a clud user belépésekor indul
...@@ -35,7 +41,7 @@ VM kontextualizálását végzi ...@@ -35,7 +41,7 @@ VM kontextualizálását végzi
- c:\circle\agemt-wdog-winservice.exe - c:\circle\agemt-wdog-winservice.exe
- c:\circle\agent-notify.exe - c:\circle\agent-notify.exe
### tesztelve *** ### tesztelve ###
- windows 10, 11 - windows 10, 11
- Win7-re az ez a verzió nem megy fel. Régit kell hazsnálni. - Win7-re az ez a verzió nem megy fel. Régit kell hazsnálni.
...@@ -60,10 +66,10 @@ VM kontextualizálását végzi ...@@ -60,10 +66,10 @@ VM kontextualizálását végzi
* cloud * cloud
### hálózat ### ### hálózat ###
* ubuntu alatt a ```/etc/network/interfaces``` fájlt piszkálja * ubuntu alatt a ```/etc/network/interfaces``` fájlt piszkálja **TODO**: ifupdown elfelejtése
### DNS ### ### DNS ###
* Linux alatt még a ```resolv.conf```-ot piszkálja **TODO** * Linux alatt még a ```resolv.conf```-ot piszkálja **TODO**: átállás systemd-resolved -re
#### SMBFS #### #### SMBFS ####
* mindenhol case insensitive, kiveve a /etc/nsmb.conf-ban es a ~/.nsmbrc-ben, itt a userneveket szigoruan upper-case kell irni * mindenhol case insensitive, kiveve a /etc/nsmb.conf-ban es a ~/.nsmbrc-ben, itt a userneveket szigoruan upper-case kell irni
......
...@@ -6,6 +6,7 @@ import logging ...@@ -6,6 +6,7 @@ import logging
import platform import platform
import subprocess import subprocess
import sys import sys
from shutil import rmtree
logging.basicConfig( logging.basicConfig(
format="[%(asctime)s] %(levelname)s [agent %(process)d/%(thread)d] %(module)s.%(funcName)s:%(lineno)d] %(message)s", format="[%(asctime)s] %(levelname)s [agent %(process)d/%(thread)d] %(module)s.%(funcName)s:%(lineno)d] %(message)s",
...@@ -18,8 +19,7 @@ logger.setLevel(level) ...@@ -18,8 +19,7 @@ logger.setLevel(level)
system = platform.system() # noqa system = platform.system() # noqa
logger.debug("system:%s", system) logger.debug("system:%s", system)
if len(sys.argcv) != 1 and (system == "Linux" or system == "FreeBSD"): # noqa
def linux_install:
logger.info("Installing agent on %s system", system) logger.info("Installing agent on %s system", system)
try: # noqa try: # noqa
chdir(sys.path[0]) # noqa chdir(sys.path[0]) # noqa
...@@ -28,7 +28,7 @@ def linux_install: ...@@ -28,7 +28,7 @@ def linux_install:
copy_file("misc/vm_renewal", "/usr/bin/vm_renewal", mode=0o755) copy_file("misc/vm_renewal", "/usr/bin/vm_renewal", mode=0o755)
if copy_file("misc/agent.service", "/etc/systemd/system/agent.service"): if copy_file("misc/agent.service", "/etc/systemd/system/agent.service"):
subprocess.call(('systemctl', 'enable', 'agent')) subprocess.call(('systemctl', 'enable', 'agent'))
shutil.rmtree('win_exe') rmtree('win_exe', ignore_errors=True)
except Exception as e: # noqa except Exception as e: # noqa
logger.exception("Unhandled exeption: %s", e) logger.exception("Unhandled exeption: %s", e)
pass # hope it works # noqa pass # hope it works # noqa
...@@ -207,9 +207,6 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -207,9 +207,6 @@ class SerialLineReceiver(SerialLineReceiverBase):
pass pass
def main(): def main():
if system == "Linux" or system == "FreeBSD": # noqa
if len(sys.argv) != 1 and (if (sys.argv[1] == "-i" or sys.argv[1] "--install"):
linux_install()
# Get proper serial class and port name # Get proper serial class and port name
(serial, port) = get_serial() (serial, port) = get_serial()
logger.info("Opening port %s", port) logger.info("Opening port %s", port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment