Commit 28c18722 authored by thiolliere's avatar thiolliere
Browse files

add diskpart

this involve having uac_admin rights
pyinstaller have an option but it only works on onedir
so we can return to onedir but finding application is not very handy
anymore
maybe we can have a batch script.
parent b02cd71f
...@@ -60,8 +60,12 @@ install: ...@@ -60,8 +60,12 @@ install:
- if %platform%==x86 type build\pibox-installer-win32\warnpibox-installer-win32.txt - if %platform%==x86 type build\pibox-installer-win32\warnpibox-installer-win32.txt
- if %platform%==x64 type build\pibox-installer-win64\warnpibox-installer-win64.txt - if %platform%==x64 type build\pibox-installer-win64\warnpibox-installer-win64.txt
# Deploy # Deploy
- 7z.exe a -r C:\projects\pibox-installer\dist\pibox-installer.zip C:\projects\pibox-installer\dist\pibox-installer
- move C:\projects\pibox-installer\dist\pibox-installer.zip C:\msys64\home\appveyor\
- move C:\projects\pibox-installer\pibox_installer_ci_rsa C:\msys64\home\appveyor\ - move C:\projects\pibox-installer\pibox_installer_ci_rsa C:\msys64\home\appveyor\
- move C:\projects\pibox-installer\dist\pibox-installer.exe C:\msys64\home\appveyor\
- if %platform%==x86 C:\msys64\usr\bin\bash --login -c "scp -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa pibox-installer.exe pibox_ci@buildbot.wan.bsf-intranet.org:/srv/repos/pibox/$(date +'%%Y-%%m-%%d')/pibox-installer-win32.exe" - if %platform%==x86 C:\msys64\usr\bin\bash --login -c "scp -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa pibox-installer.zip pibox_ci@buildbot.wan.bsf-intranet.org:/srv/repos/pibox/$(date +'%%Y-%%m-%%d')/pibox-installer-win32.zip"
- if %platform%==x64 C:\msys64\usr\bin\bash --login -c "scp -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa pibox-installer.exe pibox_ci@buildbot.wan.bsf-intranet.org:/srv/repos/pibox/$(date +'%%Y-%%m-%%d')/pibox-installer-win64.exe" - if %platform%==x64 C:\msys64\usr\bin\bash --login -c "scp -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa pibox-installer.zip pibox_ci@buildbot.wan.bsf-intranet.org:/srv/repos/pibox/$(date +'%%Y-%%m-%%d')/pibox-installer-win64.zip"
...@@ -81,11 +81,17 @@ pyz = PYZ(a.pure, a.zipped_data, ...@@ -81,11 +81,17 @@ pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher) cipher=block_cipher)
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,
a.binaries, exclude_binaries=True,
a.zipfiles,
a.datas,
name='pibox-installer', name='pibox-installer',
debug=False, debug=False,
strip=False, strip=False,
upx=True, upx=True,
console=True) console=False,
uac_admin=True)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='pibox-installer')
...@@ -81,11 +81,17 @@ pyz = PYZ(a.pure, a.zipped_data, ...@@ -81,11 +81,17 @@ pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher) cipher=block_cipher)
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,
a.binaries, exclude_binaries=True,
a.zipfiles,
a.datas,
name='pibox-installer', name='pibox-installer',
debug=False, debug=False,
strip=False, strip=False,
upx=True, upx=True,
console=True) console=False,
uac_admin=True)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='pibox-installer')
...@@ -80,6 +80,20 @@ class Emulator: ...@@ -80,6 +80,20 @@ class Emulator:
elif os.name == "nt": elif os.name == "nt":
image = os.open(self._image, os.O_RDONLY | os.O_BINARY) image = os.open(self._image, os.O_RDONLY | os.O_BINARY)
device = os.open(device_name, os.O_WRONLY | os.O_BINARY) device = os.open(device_name, os.O_WRONLY | os.O_BINARY)
matches = re.findall(r"\\\\.\\PHYSICALDRIVE(\d*)", device_name)
if len(matches) != 1:
raise ValueError("Error while getting physical drive number")
device_number = matches[0]
r,w = os.pipe()
os.write(w, str.encode("select disk {}\n".format(device_number)))
os.write(w, b"clean\n")
os.close(w)
self._logger.std("diskpart select disk % and clean" % device_number)
output = subprocess.check_output(["diskpart"], stdin=r, stderr=subprocess.STDOUT)
self._logger.raw_std(output)
else: else:
self._logger.err("platform not supported") self._logger.err("platform not supported")
return return
......
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 to comment