Commit 6f2b7aef by Csók Tamás

client: client created files fixed to APPDATA/CIRCLE

parent 72972bc8
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
InstallDir "${DefaulLocation}" InstallDir "${DefaulLocation}"
;Get installation folder from registry if available ;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${Company} ${AppName}" "install_directory" InstallDirRegKey HKLM "Software\${Company} ${AppName}" "install_directory"
;Request application privileges ;Request application privileges
RequestExecutionLevel admin RequestExecutionLevel admin
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
;-------------------------------- ;--------------------------------
;Language Selection Dialog Settings ;Language Selection Dialog Settings
;Remember the installer language ;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU" !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${Company} ${AppName}" !define MUI_LANGDLL_REGISTRY_KEY "Software\${Company} ${AppName}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
...@@ -197,6 +197,7 @@ ...@@ -197,6 +197,7 @@
Var /GLOBAL found_python Var /GLOBAL found_python
Var /GLOBAL nx_install Var /GLOBAL nx_install
Var /GLOBAL append Var /GLOBAL append
Var /GLOBAL running_directory
;-------------------------------- ;--------------------------------
;Installer Sections ;Installer Sections
SectionGroup /e '!$(NAME_Install)' SectionGroup /e '!$(NAME_Install)'
...@@ -207,9 +208,18 @@ SectionGroup /e '!$(NAME_Install)' ...@@ -207,9 +208,18 @@ SectionGroup /e '!$(NAME_Install)'
;ADD OWN FILES HERE---------------------------------------- ;ADD OWN FILES HERE----------------------------------------
File /r /x *nxclient-3.5.0-9.exe /x *nx_client_installer.py installer File /r /x *nxclient-3.5.0-9.exe /x *nx_client_installer.py installer
File /r uninstaller File /r uninstaller
;Initialize Running Directory
ClearErrors
ReadRegStr $running_directory HKLM "Software\${Company} ${AppName}" "running_directory"
${If} ${Errors}
StrCpy $running_directory ${DefaulLocation}
ClearErrors
${EndIf}
;Store installation folder ;Store installation folder
WriteRegStr HKCU "Software\${Company} ${AppName}" "install_directory" $INSTDIR WriteRegStr HKLM "Software\${Company} ${AppName}" "install_directory" $INSTDIR
WriteRegStr HKLM "Software\${Company} ${AppName}" "running_directory" $running_directory
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\${AppUninstaller}" WriteUninstaller "$INSTDIR\${AppUninstaller}"
...@@ -248,6 +258,12 @@ Function .onInit ...@@ -248,6 +258,12 @@ Function .onInit
${DisableX64FSRedirection} ${DisableX64FSRedirection}
SetRegView 64 SetRegView 64
${EndIf} ${EndIf}
ClearErrors
ReadRegStr $INSTDIR HKLM "Software\${Company} ${AppName}" "install_directory"
${If} ${Errors}
StrCpy $INSTDIR ${DefaulLocation}
ClearErrors
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd FunctionEnd
Function PythonSearch Function PythonSearch
...@@ -341,7 +357,7 @@ Function Done ...@@ -341,7 +357,7 @@ Function Done
done: done:
DetailPrint '$(STATUS_ExecutingScript) $INSTDIR\install(_error).log' DetailPrint '$(STATUS_ExecutingScript) $INSTDIR\install(_error).log'
Sleep ${LogInformationTime} Sleep ${LogInformationTime}
ExecWait '"$INSTDIR\installer\install.cmd" "$INSTDIR" ${Show_output} $nx_install "${AppUrl}" $append >"$INSTDIR\install.log" 2>"$INSTDIR\install_error.log"' ExecWait '"$INSTDIR\installer\install.cmd" "$INSTDIR" "$running_directory" ${Show_output} $nx_install "${AppUrl}" $append >"$INSTDIR\install.log" 2>"$INSTDIR\install_error.log"'
RMDir /r "$INSTDIR\installer" RMDir /r "$INSTDIR\installer"
FunctionEnd FunctionEnd
Function CallbackFunction Function CallbackFunction
...@@ -844,6 +860,13 @@ FunctionEnd ...@@ -844,6 +860,13 @@ FunctionEnd
;-------------------------------- ;--------------------------------
;Uninstaller Section ;Uninstaller Section
Section "Uninstall" Section "Uninstall"
ClearErrors
ReadRegStr $running_directory HKLM "Software\${Company} ${AppName}" "running_directory"
${If} ${Errors}
StrCpy $running_directory ${DefaulLocation}
ClearErrors
${EndIf}
StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +4 StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +4
IfFileExists "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url" 0 +2 IfFileExists "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url" 0 +2
Delete "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url" Delete "$SMPROGRAMS\${Company}\Ltogasd meg a ${AppUrlName}-t.url"
...@@ -861,10 +884,10 @@ Section "Uninstall" ...@@ -861,10 +884,10 @@ Section "Uninstall"
IfFileExists "$INSTDIR\uninstaller\*.*" 0 +2 IfFileExists "$INSTDIR\uninstaller\*.*" 0 +2
RMDir /r "$INSTDIR\uninstaller" RMDir /r "$INSTDIR\uninstaller"
IfFileExists "$INSTDIR\.rdp\*.*" 0 +2 IfFileExists "$running_directory\.rdp\*.*" 0 +2
RMDir /r "$INSTDIR\.rdp" RMDir /r "$running_directory\.rdp"
IfFileExists "$INSTDIR\client.log" 0 +2 IfFileExists "$running_directory\client.log" 0 +2
Delete "$INSTDIR\client.log" Delete "$running_directory\client.log"
IfFileExists "$INSTDIR\cloud.py" 0 +2 IfFileExists "$INSTDIR\cloud.py" 0 +2
Delete "$INSTDIR\cloud.py" Delete "$INSTDIR\cloud.py"
IfFileExists "$INSTDIR\cloud_connect_from_windows.py" 0 +2 IfFileExists "$INSTDIR\cloud_connect_from_windows.py" 0 +2
...@@ -892,7 +915,7 @@ SectionEnd ...@@ -892,7 +915,7 @@ SectionEnd
;Uninstaller Functions ;Uninstaller Functions
Function un.onInit Function un.onInit
ClearErrors ClearErrors
ReadRegStr $0 HKCU "Software\${Company} ${AppName}" "install_directory" ReadRegStr $0 HKLM "Software\${Company} ${AppName}" "install_directory"
${If} ${Errors} ${If} ${Errors}
${IF} $INSTDIR == "" ${IF} $INSTDIR == ""
StrCpy $INSTDIR "$LOCALAPPDATA\CIRCLE" StrCpy $INSTDIR "$LOCALAPPDATA\CIRCLE"
......
...@@ -9,8 +9,8 @@ The Client job is to help the ease of use of the cloud system. ...@@ -9,8 +9,8 @@ The Client job is to help the ease of use of the cloud system.
import platform import platform
import argparse import argparse
import logging import logging
import os
from time import gmtime, strftime from time import gmtime, strftime
from windowsclasses import ClientRegistry
class Struct: class Struct:
...@@ -49,7 +49,7 @@ def parse_arguments(): ...@@ -49,7 +49,7 @@ def parse_arguments():
help="Explicit location of the wanted logfile location and name", help="Explicit location of the wanted logfile location and name",
type=str, type=str,
default=("%(directory)s\\%(file)s" % { default=("%(directory)s\\%(file)s" % {
'directory': os.path.dirname(os.path.abspath(__file__)), 'directory': ClientRegistry.directory(),
'file': 'client.log'})) 'file': 'client.log'}))
args = parser.parse_args() args = parser.parse_args()
return args return args
......
...@@ -15,6 +15,7 @@ import win32crypt ...@@ -15,6 +15,7 @@ import win32crypt
import binascii import binascii
import nxkey import nxkey
import logging import logging
from windowsclasses import ClientRegistry
def connect(vm): def connect(vm):
...@@ -73,7 +74,7 @@ def connect(vm): ...@@ -73,7 +74,7 @@ def connect(vm):
subprocess.Popen(config_file, shell=True) subprocess.Popen(config_file, shell=True)
elif vm.protocol == "RDP": elif vm.protocol == "RDP":
logger.debug('NX protocol received') logger.debug('NX protocol received')
listdir = os.path.dirname(os.path.realpath(__file__)) + "\\.rdp\\*.rdp" listdir = ClientRegistry.directory() + "\\.rdp\\*.rdp"
found = False found = False
full_address = "full address:s:%s:%s" % (vm.host, vm.port) full_address = "full address:s:%s:%s" % (vm.host, vm.port)
user = "username:s:%s" % vm.user user = "username:s:%s" % vm.user
...@@ -86,8 +87,8 @@ def connect(vm): ...@@ -86,8 +87,8 @@ def connect(vm):
break break
if not found: if not found:
logger.info('No config file found, creating new one') logger.info('No config file found, creating new one')
config_file = "%s%s%s" % ((os.path.dirname( config_file = "%s%s%s" % ((
os.path.realpath(__file__)) + "\\.rdp\\"), ClientRegistry.directory() + "\\.rdp\\"),
str(int(time.time() * 1000)), ".rdp") str(int(time.time() * 1000)), ".rdp")
password = binascii.hexlify(win32crypt.CryptProtectData( password = binascii.hexlify(win32crypt.CryptProtectData(
u"%s" % vm.password, u'psw', None, None, None, 0)) u"%s" % vm.password, u'psw', None, None, None, 0))
......
...@@ -6,20 +6,28 @@ SET running_directory=%~dp0 ...@@ -6,20 +6,28 @@ SET running_directory=%~dp0
rem Set where this file will install the rest of the files rem Set where this file will install the rest of the files
SET "location=%1" SET "location=%1"
IF NOT [!location!]==[] ( IF NOT [!location!]==[] (
@echo sikerult
SET install_location=!location:"=! SET install_location=!location:"=!
) else ( ) else (
SET "install_location=%APPDATA%\CIRCLE" SET "install_location=%APPDATA%\CIRCLE"
) )
Set whether we want output info on screen or not
IF NOT [%2]==[] ( rem Set where this file will install the .rdp folder
SET "output_on_screen=%2" SET "run_location=%2"
IF NOT [!run_location!]==[] (
SET running_location=!run_location:"=!
) else (
SET "running_location=%APPDATA%\CIRCLE"
)
rem Set whether we want output info on screen or not
IF NOT [%3]==[] (
SET "output_on_screen=%3"
) else ( ) else (
SET "output_on_screen=True" SET "output_on_screen=True"
) )
rem Set whether we want to install NX Client or not rem Set whether we want to install NX Client or not
IF NOT [%3]==[] ( IF NOT [%4]==[] (
SET "install_nx=%3" SET "install_nx=%4"
) else ( ) else (
SET "install_nx=False" SET "install_nx=False"
) )
...@@ -29,28 +37,28 @@ if NOT "!install_nx!"=="False" ( ...@@ -29,28 +37,28 @@ if NOT "!install_nx!"=="False" (
rem Set which website should the icon point to rem Set which website should the icon point to
SET "site=^"http://cloud.bme.hu/^"" SET "site=^"http://cloud.bme.hu/^""
IF NOT [%4]==[] ( IF NOT [%5]==[] (
SET site=%4 SET site=%5
) )
SET my_site=!site:"=! SET my_site=!site:"=!
SET "website= -t ^"!my_site!^"" SET "website= -t ^"!my_site!^""
rem Set Python bit count (32 or 64) if we know it rem Set Python bit count (32 or 64) if we know it
IF NOT [%5]==[] ( IF NOT [%6]==[] (
SET "architecture=%5" SET "architecture=%6"
) else ( ) else (
SET "architecture=" SET "architecture="
) )
rem Set Python version if we know it rem Set Python version if we know it
IF NOT [%6]==[] ( IF NOT [%7]==[] (
SET "version=%6" SET "version=%7"
) else ( ) else (
SET "version=" SET "version="
) )
rem Set Python location if we know it rem Set Python location if we know it
SET "python_location=%7" SET "python_location=%8"
IF NOT [!python_location!]==[] ( IF NOT [!python_location!]==[] (
SET install_path=!python_location:"=! SET install_path=!python_location:"=!
) else ( ) else (
...@@ -305,8 +313,12 @@ call ^"!running_directory!inPath^" ^"install_location^" && (IF NOT "!output_on_s ...@@ -305,8 +313,12 @@ call ^"!running_directory!inPath^" ^"install_location^" && (IF NOT "!output_on_s
if not exist "!install_location!\" ( if not exist "!install_location!\" (
mkdir ^"!install_location!^" mkdir ^"!install_location!^"
) )
if not exist "!install_location!\.rdp\" ( @echo Checking wheter ^'!running_location!^\^' exists already
mkdir ^"!install_location!\.rdp^" if not exist "!running_location!\" (
mkdir ^"!running_location!^"
)
if not exist "!running_location!\.rdp\" (
mkdir ^"!running_location!\.rdp^"
) )
rem Copy the files to the folder rem Copy the files to the folder
IF NOT "!output_on_screen!"=="False" ( IF NOT "!output_on_screen!"=="False" (
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Windows icon installer for CIRCLE client application Windows installer for CIRCLE client application
""" """
import os import os
......
...@@ -54,12 +54,25 @@ class Struct: ...@@ -54,12 +54,25 @@ class Struct:
pass pass
class ClientRegistry:
@staticmethod
def directory():
handler = RegistryHandler()
directory = None
try:
directory = handler.get_key_value(
"Software\CIRCLE Cloud Client", "running_directory")
except LookupError:
directory = os.path.dirname(os.path.abspath(__file__))
return directory
class RegistryHandler: class RegistryHandler:
""" """
Registry handling class, makes registry based queries and Registry handling class, makes registry based queries and
manipulations easier. manipulations easier.
This class can handle WOW64 based application differently and none This class can handle WOW64 based application differently and
differently (default) similarly (default)
""" """
def __init__(self, args=None): def __init__(self, args=None):
...@@ -144,7 +157,7 @@ class RegistryHandler: ...@@ -144,7 +157,7 @@ class RegistryHandler:
if isinstance(value, dict) or isinstance(value, OrderedDict): if isinstance(value, dict) or isinstance(value, OrderedDict):
temp_dict = OrderedDict() temp_dict = OrderedDict()
for my_key, my_value in value.iteritems(): for my_key, my_value in value.iteritems():
temp_dict[key+"\\"+my_key] = my_value temp_dict[key + "\\" + my_key] = my_value
self.create_registry_from_dict_chain( self.create_registry_from_dict_chain(
temp_dict, False, architect, needed_rights) temp_dict, False, architect, needed_rights)
else: else:
...@@ -157,7 +170,7 @@ class RegistryHandler: ...@@ -157,7 +170,7 @@ class RegistryHandler:
connected_registy, key, 0, connected_registy, key, 0,
needed_rights | architect) needed_rights | architect)
temp_dict = OrderedDict( temp_dict = OrderedDict(
value[i:i+2] for i in range( value[i:i + 2] for i in range(
0, len(value), 2)) 0, len(value), 2))
for my_key, my_value in temp_dict.iteritems(): for my_key, my_value in temp_dict.iteritems():
if my_key == "default": if my_key == "default":
...@@ -251,7 +264,7 @@ class RegistryHandler: ...@@ -251,7 +264,7 @@ class RegistryHandler:
# print "%s found in the registry" % key_name # print "%s found in the registry" % key_name
results = {} results = {}
if int_depth >= 1: if int_depth >= 1:
for i in xrange(0, QueryInfoKey(key)[0]-1): for i in xrange(0, QueryInfoKey(key)[0] - 1):
skey_name = EnumKey(key, i) skey_name = EnumKey(key, i)
skey = OpenKey(key, skey_name, 0, KEY_ALL_ACCESS | architect) skey = OpenKey(key, skey_name, 0, KEY_ALL_ACCESS | architect)
if int_depth == 2 and QueryInfoKey(skey)[0] > 0: if int_depth == 2 and QueryInfoKey(skey)[0] > 0:
......
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