Merge pull request #96 from 45Drives/tmpFiles

Tmp files
This commit is contained in:
Jordan Keough 2025-09-16 08:52:57 -03:00 committed by GitHub
commit 658e4a1f11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 248 additions and 54 deletions

View File

@ -2,12 +2,12 @@ name: Build Packages
on:
push:
branches:
- main
- tmpFiles
tags:
- 'v*.*.*'
jobs:
prebuild:
runs-on: buildinator-group
runs-on: buildinator-5
outputs:
manifest: ${{ steps.prebuild.outputs.manifest }}
matrix: ${{ steps.prebuild.outputs.matrix }}
@ -40,7 +40,7 @@ jobs:
needs:
- prebuild
- build
runs-on: buildinator-group
runs-on: buildinator-5
steps:
- name: Run sign playbook
uses: 45drives/actions/ansible-playbook@main
@ -60,7 +60,7 @@ jobs:
- prebuild
- build
- sign
runs-on: buildinator-group
runs-on: buildinator-5
steps:
- id: push_local
name: Push packages into local repository
@ -68,17 +68,43 @@ jobs:
with:
directory: ${{ github.workspace }}
create_release:
needs:
- prebuild
- build
- sign
- update_repositories
runs-on: buildinator-5
steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "PRERELEASE=$([ "$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.stable')" = "true" ] && echo false || echo "true")" >> $GITHUB_ENV
echo "TITLE=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.title')" >> $GITHUB_ENV
echo "VERSION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.version')" >> $GITHUB_ENV
echo "REVISION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.build_number')" >> $GITHUB_ENV
- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
name: ${{env.TITLE}} ${{env.VERSION}}
prerelease: ${{env.PRERELEASE}}
body_path: ${{github.workspace}}/CHANGELOG.md
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
sync_repositories:
needs:
- prebuild
- build
- sign
- update_repositories
runs-on: buildinator-group
- create_release
runs-on: buildinator-5
steps:
- id: push_remote
name: Sync local repository with remote repository
if: startsWith(github.ref, 'refs/tags/')
uses: 45drives/actions/sync-repo@main
with:
directory: ${{ github.workspace }}
directory: ${{ github.workspace }}

View File

@ -1,4 +1,3 @@
## Cockpit Navigator 0.5.10-1
## Cockpit Navigator 0.5.11-1
* Disallow changing selected file/folder while editing permissions
* Allow opening non-text file for editing via prompt
* deleting tmp/navigotrs files and fixed auto parent folder selection

View File

@ -3,19 +3,18 @@
"name": "cockpit-navigator",
"title": "Cockpit Navigator",
"description": "A File System Browser for Cockpit.",
"version": "0.5.10",
"version": "0.5.11",
"build_number": "1",
"stable": true,
"stable": false,
"author": "Josh Boudreau <jboudreau@45drives.com>",
"git_url": "https://github.com/45Drives/cockpit-navigator",
"license": "GPL-3.0+",
"defaults": {
"urgency": "medium"
"change_urgency": "medium"
},
"architecture": {
"rocky": "x86_64",
"debian": "amd64",
"ubuntu": "amd64"
"ubuntu": "all"
},
"dependencies": {
"ubuntu_common": [
@ -24,7 +23,8 @@
"rsync",
"zip",
"file",
"coreutils"
"coreutils",
"inotify-tools"
],
"rocky_common": [
"cockpit",
@ -33,7 +33,8 @@
"zip",
"file",
"/bin/mkdir",
"/bin/rmdir"
"/bin/rmdir",
"inotify-tools"
]
},
"builds": [
@ -52,6 +53,11 @@
"os_name": "rocky-el8",
"image": "ci.cr.45d.io/ci/simple/rocky-el8:1"
},
{
"group": "debian",
"os_name": "debian-bookworm",
"image": "ci.cr.45d.io/ci/simple/ubuntu-jammy:1"
},
{
"group": "rocky",
"os_name": "rocky-el9",
@ -64,9 +70,8 @@
],
"changelog": {
"urgency": "medium",
"version": "0.5.10",
"buildVersion": "1",
"ignore": [],
"version": "0.5.11",
"build_number": "1",
"date": null,
"packager": "Josh Boudreau <jboudreau@45drives.com>",
"changes": []

View File

@ -100,46 +100,96 @@ export class NavContextMenu {
}
e.stopPropagation();
}
zip_for_download() {
return new Promise((resolve, reject) => {
var cmd = [
"/usr/share/cockpit/navigator/scripts/zip-for-download.py3",
this.nav_window_ref.pwd().path_str()
];
for (let entry of this.nav_window_ref.selected_entries) {
cmd.push(entry.path_str());
const cmd = ["/usr/share/cockpit/navigator/scripts/zip-for-download.py3",
this.nav_window_ref.pwd().path_str()];
for (const entry of this.nav_window_ref.selected_entries) cmd.push(entry.path_str());
const proc = cockpit.spawn(cmd, { superuser: "try", err: "out" });
const safeParse = (raw) => {
const s = (raw || "").trim();
const start = s.indexOf("{");
const end = s.lastIndexOf("}");
if (start === -1 || end === -1 || end < start) {
throw new Error("No JSON object in output: " + s.slice(0, 200));
}
var proc = cockpit.spawn(cmd, {superuser: "try", err: "out"});
proc.fail((e, data) => {
reject(JSON.parse(data));
});
proc.done((data) => {
resolve(JSON.parse(data));
});
});
}
async download(e) {
var download_target = "";
if (this.nav_window_ref.selected_entries.size === 1 && !(this.nav_window_ref.selected_entry() instanceof NavDir)) {
download_target = this.nav_window_ref.selected_entry();
} else {
this.nav_window_ref.start_load();
var result;
return JSON.parse(s.slice(start, end + 1));
};
proc.done((data) => {
try {
result = await this.zip_for_download();
} catch(e) {
this.nav_window_ref.stop_load();
this.nav_window_ref.modal_prompt.alert(e.message);
return;
resolve(safeParse(data));
} catch (e) {
console.error("zip_for_download done(raw):", data);
reject({ message: e.message });
}
this.nav_window_ref.stop_load();
});
proc.fail((e, data) => {
try {
reject(safeParse(data));
} catch {
console.error("zip_for_download fail(raw):", data);
reject({ message: String(data || e || "zip_for_download failed") });
}
});
});
}
async download(e) {
let download_target = "";
let result; // function-scoped so we can reference later
if (this.nav_window_ref.selected_entries.size === 1 &&
!(this.nav_window_ref.selected_entry() instanceof NavDir)) {
download_target = this.nav_window_ref.selected_entry();
} else {
this.nav_window_ref.start_load();
try {
result = await this.zip_for_download();
download_target = new NavFile(result["archive-path"], result["stat"], this.nav_window_ref);
console.log("prepared archive for download:", result["archive-path"]);
} catch (err) {
this.nav_window_ref.stop_load();
this.nav_window_ref.modal_prompt.alert(err.message);
return;
} finally {
this.nav_window_ref.stop_load();
}
}
var download = new NavDownloader(download_target);
download.download();
}
if (result?.["archive-path"]) {
const unitName = `nav-clean-on-open-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;
const script = [
'set -euo pipefail',
'if ! command -v inotifywait >/dev/null 2>&1; then ' +
'sleep 300; rm -f -- "$ARCHIVE"; ' +
'[ -n "${TEMPDIR:-}" ] && [[ "$TEMPDIR" == /tmp/navigator-* ]] && rm -rf -- "$TEMPDIR"; ' +
'exit 0; fi',
'inotifywait -q -t 1800 -e open -- "$ARCHIVE" || true',
'rm -f -- "$ARCHIVE"',
'sleep 3600',
'[ -n "${TEMPDIR:-}" ] && [[ "$TEMPDIR" == /tmp/navigator-* ]] && rm -rf -- "$TEMPDIR" || :'
].join(' && ');
const cmd = [
'systemd-run',
'--property=CollectMode=inactive-or-failed',
'--property=RuntimeMaxSec=90000',
'--unit', unitName,
'--setenv=ARCHIVE=' + result['archive-path'],
...(result['temp-dir'] ? ['--setenv=TEMPDIR=' + result['temp-dir']] : []),
'/bin/bash','-lc', script
];
await cockpit.spawn(cmd, { superuser: 'require', err: 'out' }).then(out => console.log(out));
console.log("scheduled cleanup:", unitName);
console.log("Deleting :", result['archive-path'], "in 30 minutes or after download starts.");
}
const downloader = new NavDownloader(download_target);
downloader.download();
}
delete(e) {
this.nav_window_ref.delete_selected();

View File

@ -331,6 +331,19 @@ export class NavWindow {
}
update_selection_info() {
if (this.selected_entries.size > 1) {
// get first element of the Set
const it = this.selected_entries.values();
const first = it.next().value;
const second = it.next().value;
if(first.path.length<second.path.length){
this.selected_entries.delete(first)
}
if(first.path.length==second.path.length && first.filename=="/"){
this.selected_entries.delete(first)
}
}
if (this.selected_entries.size > 1){
var name_fields = document.getElementsByClassName("nav-info-column-filename");
for (let name_field of name_fields) {

View File

@ -0,0 +1,11 @@
cockpit-navigator (0.5.11-1bookworm) bookworm; urgency=medium
* deleting tmp/navigotrs files and fixed auto parent folder selection
-- Rachit Hans <rhans@45drives.com> Mon, 15 Sep 2025 14:17:03 -0300
cockpit-navigator (0.5.10-1bookworm) bookworm; urgency=medium
* build for bookworm
-- Brett Kelly <bkelly@45drives.com> Mon, 24 Feb 2025 14:40:50 -0300

View File

@ -0,0 +1,13 @@
Source: {{ name }}
Section: utils
Priority: optional
Maintainer: {{ author }}
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.4.1
Homepage: {{ git_url }}
Vcs-Git: {{ git_url }}
Package: {{ name }}
Architecture: {{ architecture.ubuntu }}
Depends: {{ dependencies.ubuntu_common | join(',') }}
Description: {{ description }}

View File

@ -0,0 +1,35 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: "{{ name }}"
Upstream-Contact: "{{ author }}"
Source: "{{ git_url }}"
Files: *
Copyright: 2021 Josh Boudreau <jboudreau@45drives.com>
License: GPL-3.0+
Files: navigator/navigator.*
Copyright: 2021 Sam Silver <ssilver@45drives.com>
License: GPL-3.0+
Files: navigator/navigator.js
Copyright: 2021 Dawson Della Valle <ddellavalle@45drives.com>
License: GPL-3.0+
Files: debian/*
Copyright: 2021 Josh Boudreau <jboudreau@45drives.com>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with the Onboard package. If not, please have a look at
/usr/share/common-licenses or <http://www.gnu.org/licenses/>.

25
packaging/debian-bookworm/rules Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export NAV_VERS := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ':')
%:
dh $@
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -33,6 +33,8 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*
%changelog
* Mon Sep 15 2025 Rachit Hans <rhans@45drives.com> 0.5.11-1
- deleting tmp/navigotrs files and fixed auto parent folder selection
* Wed Oct 26 2022 Joshua Boudreau <jboudreau@45drives.com> 0.5.10-1
- Disallow changing selected file/folder while editing permissions
- Allow opening non-text file for editing via prompt

View File

@ -33,5 +33,7 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*
%changelog
* Mon Sep 15 2025 Rachit Hans <rhans@45drives.com> 0.5.11-1
- deleting tmp/navigotrs files and fixed auto parent folder selection
* Mon Feb 24 2025 Brett Kelly <bkelly@45drives.com> 0.5.10-1
- build for el9
- build for el9

View File

@ -1,3 +1,9 @@
cockpit-navigator (0.5.11-1focal) focal; urgency=medium
* deleting tmp/navigotrs files and fixed auto parent folder selection
-- Rachit Hans <rhans@45drives.com> Mon, 15 Sep 2025 14:17:03 -0300
cockpit-navigator (0.5.10-1focal) focal; urgency=medium
* Disallow changing selected file/folder while editing permissions

View File

@ -1,5 +1,11 @@
cockpit-navigator (0.5.11-1jammy) jammy; urgency=medium
* deleting tmp/navigotrs files and fixed auto parent folder selection
-- Rachit Hans <rhans@45drives.com> Mon, 15 Sep 2025 14:17:03 -0300
cockpit-navigator (0.5.10-1jammy) jammy; urgency=medium
* build for jammy
-- Brett Kelly <bkelly@45drives.com> Mon, 24 Feb 2025 14:40:50 -0300
-- Brett Kelly <bkelly@45drives.com> Mon, 24 Feb 2025 14:40:50 -0300