Commit 6f2b7aef by Csók Tamás

client: client created files fixed to APPDATA/CIRCLE

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