From af7941f10abacc70f1bc9968ffabfd1f279b749b Mon Sep 17 00:00:00 2001 From: Paul Johnston <12446446+maloo1@users.noreply.github.com> Date: Wed, 16 Jun 2021 02:27:10 +0800 Subject: [PATCH 1/3] Change mv to cp to preserve SELinux permissions --- gitea_auto_update/lib/download.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gitea_auto_update/lib/download.py b/gitea_auto_update/lib/download.py index 02682cd..e72ef85 100644 --- a/gitea_auto_update/lib/download.py +++ b/gitea_auto_update/lib/download.py @@ -74,10 +74,13 @@ class Download: # extracting download file cmd = "xz -d " + self.tmp_xz os.system(cmd) - # moving temp file to gtfile location - cmd = 'mv ' + self.tmp_dir + 'gitea-' + self.github_version \ + # copying temp file to gtfile location. Copying preserves SELinux permissions + cmd = 'cp ' + self.tmp_dir + 'gitea-' + self.github_version \ + '-' + self.gt_system + ' ' + self.gt_file os.system(cmd) + # cleaning up tmp file + cmd = 'rm -f ' + self.tmp_dir + 'gitea-' + self.github_version + '-' + self.gt_system + os.system(cmd) cmd = 'chmod +x ' + self.gt_file os.system(cmd) From d926a19b6cab4087541f38004a1af7b1bee22117 Mon Sep 17 00:00:00 2001 From: Paul Johnston <12446446+maloo1@users.noreply.github.com> Date: Wed, 16 Jun 2021 02:37:18 +0800 Subject: [PATCH 2/3] Changed mv to cp to preserve SELinux permissions --- gitea_auto_update/lib/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitea_auto_update/lib/build.py b/gitea_auto_update/lib/build.py index f668970..fc201ab 100644 --- a/gitea_auto_update/lib/build.py +++ b/gitea_auto_update/lib/build.py @@ -16,4 +16,4 @@ def build_from_source(tag, gt_file, source_dir): os.system("git pull") os.system("git checkout " + tag) os.system('TAGS="bindata sqlite sqlite_unlock_notify" make generate build') - os.system("mv gitea " + gt_file) + os.system("cp gitea " + gt_file) From c6621fa1176d6f0cccd598ca6b63a2648c786423 Mon Sep 17 00:00:00 2001 From: Paul Johnston <12446446+maloo1@users.noreply.github.com> Date: Wed, 16 Jun 2021 02:56:03 +0800 Subject: [PATCH 3/3] fix: Also cleaning up the build dir --- gitea_auto_update/lib/build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gitea_auto_update/lib/build.py b/gitea_auto_update/lib/build.py index fc201ab..1d1c9c3 100644 --- a/gitea_auto_update/lib/build.py +++ b/gitea_auto_update/lib/build.py @@ -17,3 +17,4 @@ def build_from_source(tag, gt_file, source_dir): os.system("git checkout " + tag) os.system('TAGS="bindata sqlite sqlite_unlock_notify" make generate build') os.system("cp gitea " + gt_file) + os.system("rm -f gitea")