chown Export File to 1000:1000

This commit is contained in:
Désiré Werner Menrath 2024-09-20 21:25:51 +02:00
parent a3f3604a1f
commit 217a73182a
2 changed files with 15 additions and 10 deletions

View File

@ -4,12 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="replace tar with zip and Check if Zip file is empty"> <list default="true" id="940e1630-c825-4d4c-be80-bc11f543c122" name="Changes" comment="Create your own message boxes for export">
<change afterPath="$PROJECT_DIR$/wp-icons/128/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/wp-icons/256/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/wp-icons/32/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/wp-icons/48/info.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/wp-icons/64/info.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/wg_func.py" beforeDir="false" afterPath="$PROJECT_DIR$/wg_func.py" afterDir="false" />
</list> </list>
@ -466,7 +461,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1726836930251</updated> <updated>1726836930251</updated>
</task> </task>
<option name="localTasksCounter" value="42" /> <task id="LOCAL-00042" summary="Create your own message boxes for export">
<option name="closed" value="true" />
<created>1726841190285</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1726841190285</updated>
</task>
<option name="localTasksCounter" value="43" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
@ -507,7 +510,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="fix label when laat Tunnel delete and fix Tuple error in delete and Start/Stop when listbox empty" />
<MESSAGE value="remove a ',' in DNS Name" /> <MESSAGE value="remove a ',' in DNS Name" />
<MESSAGE value="fix when Filname &gt; 17 first copy file after rename" /> <MESSAGE value="fix when Filname &gt; 17 first copy file after rename" />
<MESSAGE value="add export Tunnel as zip" /> <MESSAGE value="add export Tunnel as zip" />
@ -532,6 +534,7 @@
<MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" /> <MESSAGE value="install rollback bash to py wirepy and wirepy rollback to py" />
<MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" /> <MESSAGE value="fix install and .desktop File Tar works now for user home and filebrowser.askfilebrowser start now in user home" />
<MESSAGE value="replace tar with zip and Check if Zip file is empty" /> <MESSAGE value="replace tar with zip and Check if Zip file is empty" />
<option name="LAST_COMMIT_MESSAGE" value="replace tar with zip and Check if Zip file is empty" /> <MESSAGE value="Create your own message boxes for export" />
<option name="LAST_COMMIT_MESSAGE" value="Create your own message boxes for export" />
</component> </component>
</project> </project>

View File

@ -345,7 +345,7 @@ class OnOff:
class ExportTunnels: class ExportTunnels:
@staticmethod @staticmethod
def wg_export(): def wg_export():
_u1 = str(_u[6:])
now_time = datetime.now() now_time = datetime.now()
now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M') now_datetime = now_time.strftime('wg-exp-' + '%m-%d-%Y' + '-' + '%H:%M')
tl = ListTunnels.tl_list() tl = ListTunnels.tl_list()
@ -354,10 +354,12 @@ class ExportTunnels:
wg_tar = str(_u) + '/' + now_datetime wg_tar = str(_u) + '/' + now_datetime
p_to_conf = Path('/etc/wire_py/') p_to_conf = Path('/etc/wire_py/')
shutil.make_archive(wg_tar, 'zip', p_to_conf) shutil.make_archive(wg_tar, 'zip', p_to_conf)
os.chown(wg_tar + '.zip', 1000, 1000)
with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf: with zipfile.ZipFile((wg_tar + '.zip'), 'r') as zf:
if len(zf.namelist()) != 0: if len(zf.namelist()) != 0:
msg_exp_successful_window() msg_exp_successful_window()
else: else:
msg_exp_fail_window() msg_exp_fail_window()
except TypeError: except TypeError:
pass pass