Esempio n. 1
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-SKfilter', currentLanguage)
    platform2 = platform.Platform()

    try:
        print(_('Installing/Updating Node-Red (Signal K embedded)...'))
        if platform2.skDir:
            subprocess.call(
                ['npm', 'i', '--verbose', '@signalk/signalk-node-red'],
                cwd=platform2.skDir)
            subprocess.call(['chown', '-R', conf2.user, platform2.skDir])
            subprocess.call(['systemctl', 'stop', 'signalk.service'])
            subprocess.call(['systemctl', 'stop', 'signalk.socket'])
            subprocess.call(['systemctl', 'start', 'signalk.socket'])
            subprocess.call(['systemctl', 'start', 'signalk.service'])
        else:
            print(_('Failed. Please, install Signal K server.'))
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'SKfilter', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
	conf2 = conf.Conf()
	currentdir = os.path.dirname(os.path.abspath(__file__))
	currentLanguage = conf2.get('GENERAL', 'lang')
	package = 'openplotter-sdr-vhf'
	language.Language(currentdir, package, currentLanguage)

	print(_('Removing python packages...'))
	try:
		subprocess.call(['pip3', 'uninstall', '-y', 'pyrtlsdr'])
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))
	
	print(_('Removing rtl_ais service...'))
	try:
		subprocess.call(('systemctl stop openplotter-rtl_ais').split())
		subprocess.call(('systemctl disable openplotter-rtl_ais').split())
		subprocess.call(('rm -f /etc/systemd/system/openplotter-rtl_ais.service').split())
		subprocess.call(('systemctl daemon-reload').split())
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))

	subprocess.call(('python3 '+currentdir+'/unInstallGqrx.py').split())
	subprocess.call(('python3 '+currentdir+'/unInstallDvbt.py').split())
	subprocess.call(('python3 '+currentdir+'/unInstallPiaware.py').split())
	subprocess.call(('apt autoremove -y welle.io').split())

	print(_('Removing version...'))
	try:
		conf2.set('APPS', 'sdr_vhf', '')
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))
 def __init__(self, conf, currentLanguage):
     self.conf = conf
     self.platform = platform.Platform()
     currentdir = os.path.dirname(os.path.abspath(__file__))
     language.Language(currentdir, 'openplotter-opencpn-installer',
                       currentLanguage)
     self.connections = []
Esempio n. 4
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-i2c', currentLanguage)

    print(_('Adding openplotter-i2c-read service...'))
    try:
        fo = open('/etc/systemd/system/openplotter-i2c-read.service', "w")
        fo.write(
            '[Service]\nExecStart=openplotter-i2c-read\nStandardOutput=syslog\nStandardError=syslog\nUser='******'\nRestart=always\nRestartSec=5\n\n[Install]\nWantedBy=multi-user.target'
        )
        fo.close()
        subprocess.call(['systemctl', 'daemon-reload'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'i2c', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
Esempio n. 5
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-sdr-vhf', currentLanguage)

    print(_('Installing GQRX...'))
    try:
        subprocess.call(('apt install -y gqrx-sdr').split())
        if not os.path.isdir(conf2.home + '/.config/gqrx'):
            subprocess.call(('mkdir ' + conf2.home + '/.config/gqrx').split())
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Configuring GQRX...'))
    try:
        file = conf2.home + '/.config/gqrx/bookmarks.csv'
        if not os.path.isfile(file):
            subprocess.call((' cp ' + currentdir + '/data/bookmarks.csv ' +
                             conf2.home + '/.config/gqrx/').split())
        file = conf2.home + '/.config/gqrx/default.conf'
        if not os.path.isfile(file):
            subprocess.call((' cp ' + currentdir + '/data/default.conf ' +
                             conf2.home + '/.config/gqrx/').split())
        subprocess.call(
            ['chown', '-R', conf2.user, conf2.home + '/.config/gqrx'])
        subprocess.call(
            ('rm -f /usr/share/applications/gnuradio-grc.desktop').split())
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-can', currentLanguage)

    context = pyudev.Context()
    monitor = pyudev.Monitor.from_netlink(context)
    monitor.filter_by(subsystem='tty')
    print(
        _('Please connect (or disconnect and reconnect) the CAN-USB adapter'))

    for device in iter(monitor.poll, None):
        if device.action == 'add':
            value = device.get('DEVPATH')
            port = value[len(value) - value.find('/tty'):]
            port = '/dev/' + port[port.rfind('/') + 1:]
            print(port)
            try:
                ser = serial.Serial(port, 9600, timeout=0.5)
            except:
                print(
                    _('Can not open serial device (CAN-USB) connected on: ') +
                    port)
                sys.exit(0)
            ser.write(('0').encode())
            time.sleep(0.2)
            sertext = ser.readline().decode()
            if len(sertext) >= 1:
                c = '0'
                while c != '9':
                    i = 20
                    while i > 0:
                        if ser.inWaiting():
                            sertext = ser.readline().decode()
                            print(sertext[:-1])
                        else:
                            i -= 1
                            time.sleep(0.05)
                    i = 180
                    with raw(sys.stdin):
                        with nonblocking(sys.stdin):
                            while i > 0:
                                try:
                                    c = sys.stdin.read(1)
                                    #print(i,c)
                                    if c in [
                                            '1', '2', '3', '4', '5', '6', '7',
                                            '8', '9', '0'
                                    ]:
                                        ser.write(c.encode())
                                        i = -5
                                except IOError:
                                    print('Error')

                                time.sleep(.1)
                                i -= 1
                            if i > -2:
                                ser.write(('0').encode())
            sys.exit(0)
Esempio n. 7
0
	def __init__(self, conf, currentLanguage):
		self.conf = conf
		currentdir = os.path.dirname(os.path.abspath(__file__))
		language.Language(currentdir,'openplotter-kplex',currentLanguage)
		allSerialPorts = serialPorts.SerialPorts()
		self.usedSerialPorts = allSerialPorts.getSerialUsedPorts()
		self.initialMessage = _('Start Kplex...')
Esempio n. 8
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-network', currentLanguage)

    print(_('Installing python packages...'))
    try:
        subprocess.call(['pip3', 'install', 'pyric'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    try:
        print(_('Editing config files...'))

        fo = open('/etc/default/hostapd', "w")
        fo.write('DAEMON_CONF="/etc/hostapd/hostapd.conf"')
        fo.close()

        fo = open('/etc/systemd/system/openplotter-network.service', "w")
        fo.write(
            '[Service]\nExecStart=' + conf2.home +
            '/.openplotter/start-ap-managed-wifi.sh\nStandardOutput=syslog\nStandardError=syslog\nWorkingDirectory='
            + conf2.home +
            '/.openplotter\nUser=root\n\n[Install]\nWantedBy=multi-user.target\n'
        )
        fo.close()

        fo = open(
            currentdir + '/Network/udev/rules.d/11-openplotter-usb0.rules',
            "w")
        fo.write('KERNEL=="usb0", SUBSYSTEMS=="net", RUN+="/bin/bash ' +
                 conf2.home +
                 '/.openplotter/Network/11-openplotter-usb0.sh"\n')
        fo.close()

        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    try:
        print(_('Enabling services...'))

        subprocess.call(['systemctl', 'daemon-reload'])
        subprocess.call(['systemctl', 'unmask', 'hostapd.service'])
        subprocess.call(['systemctl', 'enable', 'openplotter-network'])
        if not os.path.exists('/etc/hostapd/hostapd.conf'):
            subprocess.call(['systemctl', 'disable', 'hostapd'])

        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'network', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
    def __init__(self, conf, currentLanguage):
        self.conf = conf
        currentdir = os.path.dirname(os.path.abspath(__file__))
        language.Language(currentdir, 'openplotter-moitessier',
                          currentLanguage)

        self.initialMessage = _('Checking Moitessier HAT...')
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-dashboards', currentLanguage)

    try:
        platform2 = platform.Platform()

        subprocess.call(['apt', 'install', '-y', 'grafana'])

        subprocess.call(['systemctl', 'stop', 'grafana-server'])

        subprocess.call([
            'sed', '-i', 's/http_port = 3000/http_port = 3001/g',
            '/usr/share/grafana/conf/defaults.ini'
        ])
        subprocess.call([
            'sed', '-i', 's/;http_port = 3000/http_port = 3001/g',
            '/etc/grafana/grafana.ini'
        ])

        subprocess.call(['systemctl', 'enable', 'grafana-server.service'])
        subprocess.call(['systemctl', 'start', 'grafana-server'])

        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
	conf2 = conf.Conf()
	currentdir = os.path.dirname(os.path.abspath(__file__))
	currentLanguage = conf2.get('GENERAL', 'lang')
	language.Language(currentdir,'openplotter-sdr-vhf',currentLanguage)

	platform2 = platform.Platform()
	
	try:
		print(_('Uninstalling pavucontrol...'))
		subprocess.call((platform2.admin+' apt autoremove -y pavucontrol').split())
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))

	if platform2.isRPI:
		try:
			print(_('Delete Raspberry pi settings for pulseaudio stereo...'))
			if not os.path.isdir(conf2.home+'/.config/pulse'):
				subprocess.call(('mkdir ' + conf2.home+'/.config/pulse').split())

			file = conf2.home+'/.config/pulse/default.pa'
			if os.path.isfile(file):	
				subprocess.call(('rm ' + conf2.home + '/.config/pulse/default.pa').split())

			print(_('DONE'))
		except Exception as e: print(_('FAILED: ')+str(e))
def main():
	conf2 = conf.Conf()
	currentdir = os.path.dirname(os.path.abspath(__file__))
	currentLanguage = conf2.get('GENERAL', 'lang')
	language.Language(currentdir,'openplotter-moitessier',currentLanguage)


	print(_('Copying driver packages...'))
	try:
		confFolder = conf2.conf_folder+'/moitessier'
		if not os.path.exists(confFolder): os.mkdir(confFolder)

		packageFolder = currentdir+'/packages'
		if os.path.exists(packageFolder):
			tmp = os.listdir(packageFolder)
			for i in tmp:
				shutil.copy(packageFolder+'/'+i, confFolder)

		subprocess.call(['chown', '-R', conf2.user, confFolder])

		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))

	print(_('Setting version...'))
	try:
		conf2.set('APPS', 'moitessier', version)
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))
	def __init__(self, process):
		self.conf = conf.Conf()
		self.process = process
		self.platform = platform.Platform()
		self.currentdir = os.path.dirname(os.path.abspath(__file__))
		currentLanguage = self.conf.get('GENERAL', 'lang')
		self.language = language.Language(self.currentdir,'openplotter-dashboards',currentLanguage)
		
		wx.Dialog.__init__(self, None, title=_('Process management for') + ' ' + process, size=(450,320))
		pnl = wx.Panel(self)
		pnl.SetBackgroundColour(wx.Colour(230,230,230,255))
		icon = wx.Icon(self.currentdir+"/data/openplotter-dashboards.png", wx.BITMAP_TYPE_PNG)
		self.SetIcon(icon)		
		
		self.lblList = [_('Enable'),_('Disable')]

		self.systemdbox = wx.RadioBox(pnl, label = 'Autostart', choices = self.lblList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS)
		self.systemdbox.Bind(wx.EVT_RADIOBOX,self.onSystemdBox)

		sbox0 = wx.BoxSizer(wx.VERTICAL)
		sbox0.Add(self.systemdbox, 0, wx.ALL, 5)
		#sbox0.Add(self.skbox, 0, wx.ALL, 5)

		sbox = wx.StaticBox(pnl, -1, _('Status'))

		self.aStatusList = [_('active'),_('inactive')]
		self.aStatusbox = wx.RadioBox(pnl, label = _('ActiveState'), choices = self.aStatusList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS)
		self.aStatusbox.Enable(False)

		self.bStatusList = [_('running'),_('dead')] 
		self.bStatusbox = wx.RadioBox(pnl, label = _('Substate'), choices = self.bStatusList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS)
		self.bStatusbox.Enable(False)

		sbox1 = wx.StaticBoxSizer(sbox, wx.VERTICAL)
		sbox1.Add(self.aStatusbox, 0, wx.ALL, 5)
		sbox1.Add(self.bStatusbox, 0, wx.ALL, 5)

		hbox = wx.BoxSizer(wx.HORIZONTAL)
		hbox.Add(sbox0, 1, wx.ALL, 5)
		hbox.AddStretchSpacer(1)
		hbox.Add(sbox1, 1, wx.ALL, 5)

		self.start = wx.Button(pnl, label=_('Start'))
		self.start.Bind(wx.EVT_BUTTON, self.onStart)
		self.stop = wx.Button(pnl, label=_('Stop'))
		self.stop.Bind(wx.EVT_BUTTON, self.onStop)
		self.restart = wx.Button(pnl, label=_('Restart'))
		self.restart.Bind(wx.EVT_BUTTON, self.onRestart)
		
		vbox = wx.BoxSizer(wx.VERTICAL)
		vbox.Add(hbox, 0, wx.ALL, 0)
		vbox.AddStretchSpacer(1)
		vbox.Add(self.start, 0, wx.LEFT | wx.BOTTOM, 5)
		vbox.Add(self.stop, 0, wx.ALL, 5)
		vbox.Add(self.restart, 0, wx.ALL, 5)
		pnl.SetSizer(vbox)

		self.statusUpdate()
		self.Centre() 
		self.Show(True)
	def __init__(self):
		import pyric.pyw as pyw
		
		self.conf = conf.Conf()
		self.conf_folder = self.conf.conf_folder
		self.platform = platform.Platform()
		self.currentdir = os.path.dirname(os.path.abspath(__file__))
		currentLanguage = self.conf.get('GENERAL', 'lang')
		self.language = language.Language(self.currentdir,'openplotter-network',currentLanguage)

		wx.Frame.__init__(self, None, title=_('Network')+' '+version, size=(800,444))
		self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
		icon = wx.Icon(self.currentdir+"/data/openplotter-network.png", wx.BITMAP_TYPE_PNG)
		self.SetIcon(icon)
		self.CreateStatusBar()
		font_statusBar = self.GetStatusBar().GetFont()
		font_statusBar.SetWeight(wx.BOLD)
		self.GetStatusBar().SetFont(font_statusBar)

		self.toolbar1 = wx.ToolBar(self, style=wx.TB_TEXT)
		toolHelp = self.toolbar1.AddTool(101, _('Help'), wx.Bitmap(self.currentdir+"/data/help.png"))
		self.Bind(wx.EVT_TOOL, self.OnToolHelp, toolHelp)
		if not self.platform.isInstalled('openplotter-doc'): self.toolbar1.EnableTool(101,False)
		toolSettings = self.toolbar1.AddTool(102, _('Settings'), wx.Bitmap(self.currentdir+"/data/settings.png"))
		self.Bind(wx.EVT_TOOL, self.OnToolSettings, toolSettings)
		self.toolbar1.AddSeparator()
		toolAddresses = self.toolbar1.AddTool(103, _('Addresses and Ports'), wx.Bitmap(self.currentdir+"/data/ports.png"))
		self.Bind(wx.EVT_TOOL, self.OnToolAddresses, toolAddresses)
		toolCheck = self.toolbar1.AddTool(104, _('Check Network'), wx.Bitmap(self.currentdir+"/data/check.png"))
		self.Bind(wx.EVT_TOOL, self.OnToolCheck, toolCheck)
		self.toolbar1.AddSeparator()
		toolDrivers = self.toolbar1.AddTool(105, _('Install Wifi Drivers'), wx.Bitmap(self.currentdir+"/data/package.png"), shortHelp=_('This does only help for unrecognized usb wlan type:') + ' 8188eu,8188fu,8192eu,8192su,8812au,8822bu,mt7610,mt7612')
		self.Bind(wx.EVT_TOOL, self.OnToolDrivers, toolDrivers)

		self.notebook = wx.Notebook(self)
		self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChange)
		self.ap = wx.Panel(self.notebook)
		self.output = wx.Panel(self.notebook)
		self.notebook.AddPage(self.ap, _('Access Point'))
		self.notebook.AddPage(self.output, '')
		self.il = wx.ImageList(24, 24)
		img0 = self.il.Add(wx.Bitmap(self.currentdir+"/data/ap.png", wx.BITMAP_TYPE_PNG))
		img1 = self.il.Add(wx.Bitmap(self.currentdir+"/data/output.png", wx.BITMAP_TYPE_PNG))
		self.notebook.AssignImageList(self.il)
		self.notebook.SetPageImage(0, img0)
		self.notebook.SetPageImage(1, img1)

		vbox = wx.BoxSizer(wx.VERTICAL)
		vbox.Add(self.toolbar1, 0, wx.EXPAND)
		vbox.Add(self.notebook, 1, wx.EXPAND)
		self.SetSizer(vbox)

		self.pageAp()
		self.pageOutput()
		self.read_wifi_conf()

		maxi = self.conf.get('GENERAL', 'maximize')
		if maxi == '1': self.Maximize()
		
		self.Centre() 
Esempio n. 15
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-serial', currentLanguage)

    print(_('Editing GPSD config file...'))
    try:
        path = '/etc/default/gpsd'
        if not os.path.exists(path):
            fo = open(path, "w")
            fo.write(
                'START_DAEMON="false"\nUSBAUTO="false"\nDEVICES=""\nGPSD_OPTIONS="-n -b"'
            )
            fo.close()
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'serial', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
Esempio n. 16
0
 def __init__(self, conf, currentLanguage):
     self.conf = conf
     currentdir = os.path.dirname(os.path.abspath(__file__))
     language.Language(currentdir, 'openplotter-serial', currentLanguage)
     allSerialPorts = serialPorts.SerialPorts()
     self.usedSerialPorts = allSerialPorts.getSerialUsedPorts()
     self.initialMessage = _('Checking serial connections alias...')
Esempio n. 17
0
 def __init__(self, conf, currentLanguage):
     self.conf = conf
     currentdir = os.path.dirname(os.path.abspath(__file__))
     language.Language(currentdir, 'openplotter-dashboards',
                       currentLanguage)
     self.platform = platform.Platform()
     self.connections = []
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    package = 'openplotter-myapp'  ### replace openplotter-myapp by the name of your package
    language.Language(currentdir, package, currentLanguage)

    print(_('Removing app from OpenPlotter...'))
    try:
        externalApps0 = eval(conf2.get('APPS', 'external_apps'))
        externalApps1 = []
        for i in externalApps0:
            if i['package'] != package: externalApps1.append(i)
        conf2.set('APPS', 'external_apps', str(externalApps1))
        os.system(
            'rm -f /etc/apt/sources.list.d/myapp.list'
        )  ### replace myapp.list by the name of your sources file (see myappPostInstall.py script).
        os.system('apt update')
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    ###
    ### Do here whatever you need to remove files and programs before app uninstallation. This file will be executed as sudo.
    ###

    print(_('Removing version...'))
    try:
        conf2.set(
            'APPS', 'myapp', ''
        )  ### replace myapp by the name of your app, use the same name in openplotterMyapp.py and myappPostInstall.py scripts.
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-kplex', currentLanguage)

    print(_('Adding kplex service...'))
    try:
        fo = open('/etc/systemd/system/openplotter-kplex.service', "w")
        fo.write(
            '[Unit]\n' + 'Description = NMEA 0183 Multiplexer\n' +
            'Documentation = http://www.stripydog.com/kplex/configuration.html\n'
            + 'After=syslog.target network.target audit.service\n' +
            '[Service]\n' + 'Type=forking\n' + 'PIDFILE=/var/run/kplex.pid\n' +
            'ExecStart=/usr/bin/kplex -p /var/run/kplex.pid -o mode=background\n'
            + 'KillMode=process\n' + '[Install]\n' +
            'WantedBy=multi-user.target\n')

        #fo.write( #'[Service]\nExecStart=kplex\nStandardOutput=syslog\nStandardError=syslog\nUser='******'\nRestart=always\nRestartSec=5\n\n[#Install]\nWantedBy=multi-user.target')
        fo.close()
        subprocess.call(['systemctl', 'daemon-reload'])
        subprocess.call(['systemctl', 'enable', 'openplotter-kplex'])

        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'kplex', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
    conf2 = conf.Conf()
    platform2 = platform.Platform()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    package = 'openplotter-sdr-vhf'
    language.Language(currentdir, package, currentLanguage)

    print(_('Installing python packages...'))
    try:
        subprocess.call(['pip3', 'install', 'pyrtlsdr'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Copying udev rules...'))
    try:
        subprocess.call([
            'cp', '-f', currentdir + '/data/rtl-sdr.rules',
            '/etc/udev/rules.d/'
        ])
        subprocess.call(['udevadm', 'control', '--reload-rules'])
        subprocess.call(['udevadm', 'trigger'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Setting version...'))
    try:
        conf2.set('APPS', 'sdr_vhf', version)
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-sdr-ais', currentLanguage)

    platform2 = platform.Platform()
    try:
        print(_('Adding rtl_ais service...'))
        subprocess.call((' systemctl stop openplotter-rtl_ais').split())
        subprocess.call((' systemctl disable openplotter-rtl_ais').split())
        subprocess.call((' systemctl daemon-reload').split())

        subprocess.call(
            (platform2.admin +
             ' rm /etc/systemd/system/openplotter-rtl_ais.service').split())

        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    try:
        print(_('remove rtl_ais...'))
        subprocess.call((' rm /usr/local/bin/rtl_ais').split())
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
Esempio n. 22
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-sdr-vhf', currentLanguage)

    print(_('Installing w-scan and VLC...'))
    try:
        subprocess.call(('apt install -y w-scan vlc').split())
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Configuring VLC...'))
    try:
        fo = open('/usr/share/applications/DVB-T.desktop', "w")
        fo.write(
            '[Desktop Entry]\nVersion=1.0\nName=SDR DVB-T\nGenericName=SDR DVB-T\nComment=SDR DVB-T\nExec=/usr/bin/vlc '
            + conf2.home +
            '/.openplotter/dvb.xspf\nTryExec=/usr/bin/vlc\nIcon=vlc\nTerminal=false\nType=Application\nCategories=AudioVideo;Player;Recorder;\nMimeType=application/ogg;application/x-ogg;audio/ogg;audio/vorbis;audio/x-vorbis;audio/x-vorbis+ogg;video/ogg;video/x-ogm;video/x-ogm+ogg;video/x-theora+ogg;video/x-theora;audio/x-speex;audio/opus;application/x-flac;audio/flac;audio/x-flac;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;audio/x-ms-wma;video/x-ms-asf;video/x-ms-asf-plugin;video/x-ms-asx;video/x-ms-wm;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvx;video/x-msvideo;audio/x-pn-windows-acm;video/divx;video/msvideo;video/vnd.divx;video/avi;video/x-avi;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/vnd.rn-realaudio;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-real-audio;audio/x-realaudio;video/vnd.rn-realvideo;audio/mpeg;audio/mpg;audio/mp1;audio/mp2;audio/mp3;audio/x-mp1;audio/x-mp2;audio/x-mp3;audio/x-mpeg;audio/x-mpg;video/mp2t;video/mpeg;video/mpeg-system;video/x-mpeg;video/x-mpeg2;video/x-mpeg-system;application/mpeg4-iod;application/mpeg4-muxcodetable;application/x-extension-m4a;application/x-extension-mp4;audio/aac;audio/m4a;audio/mp4;audio/x-m4a;audio/x-aac;video/mp4;video/mp4v-es;video/x-m4v;application/x-quicktime-media-link;application/x-quicktimeplayer;video/quicktime;application/x-matroska;audio/x-matroska;video/x-matroska;video/webm;audio/webm;audio/3gpp;audio/3gpp2;audio/AMR;audio/AMR-WB;video/3gp;video/3gpp;video/3gpp2;x-scheme-handler/mms;x-scheme-handler/mmsh;x-scheme-handler/rtsp;x-scheme-handler/rtp;x-scheme-handler/rtmp;x-scheme-handler/icy;x-scheme-handler/icyx;application/x-cd-image;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;x-content/audio-cdda;x-content/audio-player;application/ram;application/xspf+xml;audio/mpegurl;audio/x-mpegurl;audio/scpls;audio/x-scpls;text/google-video-pointer;text/x-google-video-pointer;video/vnd.mpegurl;application/vnd.apple.mpegurl;application/vnd.ms-asf;application/vnd.ms-wpl;application/sdp;audio/dv;video/dv;audio/x-aiff;audio/x-pn-aiff;video/x-anim;video/x-nsv;video/fli;video/flv;video/x-flc;video/x-fli;video/x-flv;audio/wav;audio/x-pn-au;audio/x-pn-wav;audio/x-wav;audio/x-adpcm;audio/ac3;audio/eac3;audio/vnd.dts;audio/vnd.dts.hd;audio/vnd.dolby.heaac.1;audio/vnd.dolby.heaac.2;audio/vnd.dolby.mlp;audio/basic;audio/midi;audio/x-ape;audio/x-gsm;audio/x-musepack;audio/x-tta;audio/x-wavpack;audio/x-shorten;application/x-shockwave-flash;application/x-flash-video;misc/ultravox;image/vnd.rn-realpix;audio/x-it;audio/x-mod;audio/x-s3m;audio/x-xm;application/mxf;video/h264;\nX-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb\nKeywords=Player;Capture;DVD;Audio;Video;Server;Broadcast;'
        )
        fo.close()
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
Esempio n. 23
0
def main():
	conf2 = conf.Conf()
	currentdir = os.path.dirname(os.path.abspath(__file__))
	currentLanguage = conf2.get('GENERAL', 'lang')
	language.Language(currentdir,'openplotter-dashboards',currentLanguage)

	try:
		platform2 = platform.Platform()

		subprocess.call(['systemctl', 'disable', 'kapacitor.service'])
		subprocess.call(['systemctl', 'stop', 'kapacitor'])
		subprocess.call(['systemctl', 'disable', 'influxdb.service'])
		subprocess.call(['systemctl', 'stop', 'influxdb'])
		subprocess.call(['systemctl', 'disable', 'chronograf.service'])
		subprocess.call(['systemctl', 'stop', 'chronograf'])

		subprocess.call(['apt', 'autoremove', '-y', 'influxdb', 'kapacitor', 'chronograf'])

		subprocess.call(['npm', 'uninstall', '--verbose', 'signalk-to-influxdb', '--save'], cwd = platform2.skDir)
		
		subprocess.call(['systemctl', 'stop', 'signalk.service'])
		subprocess.call(['systemctl', 'stop', 'signalk.socket'])
		subprocess.call(['systemctl', 'start', 'signalk.socket'])
		subprocess.call(['systemctl', 'start', 'signalk.service'])
		
		print(_('DONE'))
	except Exception as e: print(_('FAILED: ')+str(e))
Esempio n. 24
0
def main():
    conf2 = conf.Conf()
    currentdir = os.path.dirname(os.path.abspath(__file__))
    currentLanguage = conf2.get('GENERAL', 'lang')
    package = 'openplotter-gpio'
    language.Language(currentdir, package, currentLanguage)

    print(_('Removing python packages...'))
    try:
        subprocess.call(['pip3', 'uninstall', '-y', 'w1thermsensor'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Removing pigpiod and openplotter-gpio-read services...'))
    try:
        subprocess.call(['systemctl', 'disable', 'pigpiod'])
        subprocess.call(['systemctl', 'stop', 'pigpiod'])
        subprocess.call(['systemctl', 'disable', 'openplotter-gpio-read'])
        subprocess.call(['systemctl', 'stop', 'openplotter-gpio-read'])
        subprocess.call(
            ['rm', '-f', '/etc/systemd/system/openplotter-gpio-read.service'])
        subprocess.call(['systemctl', 'daemon-reload'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    print(_('Removing version...'))
    try:
        conf2.set('APPS', 'gpio', '')
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))
Esempio n. 25
0
    def __init__(self, conf, currentLanguage):
        self.conf = conf
        currentdir = os.path.dirname(os.path.abspath(__file__))
        language.Language(currentdir, 'openplotter-myapp', currentLanguage)

        self.initialMessage = _(
            'Checking "My app"...'
        )  ### "self.initialMessage" will be printed when checking the system. If it is empty the function check will not be called. Use trasnlatable text: _('Checking My App...')
Esempio n. 26
0
    def __init__(self, conf, currentLanguage):
        self.conf = conf
        currentdir = os.path.dirname(os.path.abspath(__file__))
        language.Language(currentdir, 'openplotter-myapp', currentLanguage)

        self.initialMessage = _(
            'Opening "My app"...'
        )  ### "self.initialMessage" will be printed at startup if it has content. If not, the function "start" will not be called. Use trasnlatable text: _('Starting My App...')
Esempio n. 27
0
	def __init__(self, conf, currentLanguage):
		self.conf = conf
		self.platform = platform.Platform()
		currentdir = os.path.dirname(os.path.abspath(__file__))
		language.Language(currentdir,'openplotter-opencpn-installer',currentLanguage)
		self.initialMessage = ''
		if self.platform.isInstalled('opencpn'):
			self.initialMessage = _('Checking OpenCPN...')
	def __init__(self,conf,currentLanguage):
		self.conf = conf
		currentdir = os.path.dirname(os.path.abspath(__file__))
		language.Language(currentdir,'openplotter-signalk-installer',currentLanguage)
		self.platform2 = platform.Platform()
		self.connections = []
		self.connections.append({'id':'skConn1', 'description':_('Signal K - Admin'), 'data':[], 'type':'TCP', 'mode':'server', 'address':'localhost', 'port':self.platform2.skPort, 'editable':'0'})
		self.connections.append({'id':'skConn2', 'description':_('Signal K - NMEA 0183 output'), 'data':[], 'type':'TCP', 'mode':'server', 'address':'localhost', 'port':'10110', 'editable':'0'})
Esempio n. 29
0
	def __init__(self, conf, currentLanguage):
		self.conf = conf
		self.conf_folder = self.conf.conf_folder
		currentdir = os.path.dirname(os.path.abspath(__file__))
		language.Language(currentdir,'openplotter-network',currentLanguage)
		self.initialMessage = ''
		wifi = self.conf_folder+'/Network/hostapd/hostapd.conf'
		if os.path.isfile(wifi):
			self.initialMessage =_('Checking WIFI Access Point password...')
Esempio n. 30
0
def main():
    # This file will be ran as sudo. Do here whatever you need to remove files and programs before app uninstall.
    conf2 = conf.Conf()
    currentdir = os.path.dirname(__file__)
    currentLanguage = conf2.get('GENERAL', 'lang')
    language.Language(currentdir, 'openplotter-MCS', currentLanguage)

    # here we remove the services
    print(_('Removing openplotter-read-MCS service...'))
    try:
        subprocess.call(['systemctl', 'disable', 'openplotter-MCS-read'])
        subprocess.call(['systemctl', 'stop', 'openplotter-MCS-read'])
        subprocess.call(
            ['rm', '-f', '/etc/systemd/system/openplotter-MCS-read.service'])
        subprocess.call(['systemctl', 'daemon-reload'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    ### Remove autoshutdown Service
    print(_('Removing openplotter-autoshutdown Service...'))
    try:
        subprocess.call(['systemctl', 'disable', 'openplotter-MCS-asd'])
        subprocess.call(['systemctl', 'stop', 'openplotter-MCS-asd'])
        subprocess.call(
            ['rm', '-f', '/etc/systemd/system/openplotter-MCS-asd.service'])
        subprocess.call(['systemctl', 'daemon-reload'])
        print(_('DONE'))
    except Exception as e:
        print(_('FAILED: ') + str(e))

    try:
        fo1r = open('/boot/config.txt', "r")
        configcontent = fo1r.read()
        startpos = configcontent.find(
            "#MCS-Openplotter config (Do not delete or edit this part)(start)")
        endpos = configcontent.find(
            "#MCS-Openplotter config (Do not delete or edit this part)(end)"
        ) + 63
        fo1r.close()
        before = ""
        behind = ""
        before = configcontent[:startpos]
        behind = configcontent[endpos:]
        newconfigcontent = before + behind

        if (startpos != -1):
            fo1 = open('/boot/config.txt', "w")
            fo1.write(newconfigcontent)
            fo1.close()
            print(_("config.txt entries deleted"))
        else:
            print(_("config.txt entries not exists"))

    except Exception as e:
        print(_('FAILED: ') + str(e))