From 6a9f7c6a88e60070bcda3f1f74c8fd98a8a908c2 Mon Sep 17 00:00:00 2001 From: jay Date: Thu, 29 May 2025 00:03:49 +0800 Subject: [PATCH 1/8] Added support for config file --- .gitignore | 4 +++ .vscode/launch.json | 26 ++++++++++++++ .vscode/settings.json | 6 ++++ .vscode/tasks.json | 31 ++++++++++++++++ docs/development.md | 35 +++++++++++++++++++ src/AppConsole.vala | 5 +++ src/AppGtk.vala | 3 ++ src/Core/Main.vala | 11 +++++- src/meson.build | 4 +++ ...teejeetech.pkexec.timeshift-default.policy | 20 +++++++++++ src/timeshift-gtk-env | 4 +++ src/timeshift-launcher | 2 +- 12 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy create mode 100755 src/timeshift-gtk-env diff --git a/.gitignore b/.gitignore index c9768646..d8394ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,10 @@ release/*.run .bzr .git *~ +.pc +.idea +build +builddir po-lp/ parts/ stage/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..fcd13361 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/src/timeshift", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "build", + "miDebuggerPath": "/usr/bin/gdb" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..2dde3203 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "C_Cpp.default.compileCommands": "/work/linux-workspace/timeshift/build/compile_commands.json", + "C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild", + "mesonbuild.buildFolder": "build", + "vala.languageServerPath": "/usr/local/bin/vala-language-server", +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..a2947db0 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,31 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "meson setup --reconfigure ${workspaceFolder}/build -Ddebug=true && meson compile -C ${workspaceFolder}/build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "run-gdbserver", + "type": "shell", + "command": "gdbserver localhost:12345 ${workspaceFolder}/build/src/timeshift", + "problemMatcher": [] + }, + { + "label": "clean", + "type": "shell", + "command": "meson compile -C ${workspaceFolder}/build", + "group": { + "kind": "build", + "isDefault": false + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index a6649420..ea5a1474 100644 --- a/docs/development.md +++ b/docs/development.md @@ -21,6 +21,8 @@ sudo apt install meson \ help2man \ gettext \ valac \ +scdoc \ +libvala-dev \ libvte-2.91-dev \ libgee-0.8-dev \ libjson-glib-dev \ @@ -50,6 +52,39 @@ meson compile -C build ### Step 4. Install Timeshift +Install ```bash sudo meson install -C build ``` +Uninstall +``` +cd build +sudo ninja uninstall +``` + +### Step 5. Build the debian package + +#### Package source code +```bash +tar czvf ../timeshift_24.02.1.orig.tar.gz --exclude='*.git' --exclude='.gitignore' --exclude='build' --exclude='*.swp' --exclude='*.orig' --exclude='*.rej' --exclude='*.bak' --exclude='*.gz' --exclude='*.xz' --exclude='*.bz2' --exclude='*.lzma' --exclude='debian' --exclude='archlinux' * +``` + +#### Add changelog +``` +timeshift (24.02.1-1) unstable; urgency=medium + + * 24.02.1-1 unstable minor bug fixes + + -- Jiang Meng Sun, 18 Aug 2024 20:51:22 +0800 +``` + +#### Commit your code & merge to the source tree +```bash +git commit -a -m "fixed issues" +dpkg-source --commit +``` + +#### Package +```bash +dpkg-buildpackage -us -uc +``` \ No newline at end of file diff --git a/src/AppConsole.vala b/src/AppConsole.vala index a4554b77..dc071b2f 100644 --- a/src/AppConsole.vala +++ b/src/AppConsole.vala @@ -211,6 +211,10 @@ public class AppConsole : GLib.Object { App.validate_cmd_tags(); break; + case "--config": + App.cmd_config = args[++k]; + break; + case "--debug": LOG_COMMANDS = true; LOG_DEBUG = true; @@ -367,6 +371,7 @@ public class AppConsole : GLib.Object { msg += _("Backup") + ":\n"; msg += " --check " + _("Create snapshot if scheduled") + "\n"; msg += " --create " + _("Create snapshot (even if not scheduled)") + "\n"; + msg += " --config " + _("Specify the config json") + "\n"; msg += " --comments " + _("Set snapshot description") + "\n"; msg += " --tags {O,B,H,D,W,M} " + _("Add tags to snapshot (default: O)") + "\n";; msg += "\n"; diff --git a/src/AppGtk.vala b/src/AppGtk.vala index c5414d44..d6c27e55 100644 --- a/src/AppGtk.vala +++ b/src/AppGtk.vala @@ -102,6 +102,9 @@ public class AppGtk : GLib.Object { case "--debug": LOG_DEBUG = true; break; + case "--config": + App.cmd_config = args[++k]; + break; default: //unknown option - show help and exit log_error(_("Unknown option") + ": %s".printf(args[k])); diff --git a/src/Core/Main.vala b/src/Core/Main.vala index e4b23149..0d5f16aa 100644 --- a/src/Core/Main.vala +++ b/src/Core/Main.vala @@ -148,6 +148,7 @@ public class Main : GLib.Object{ public string cmd_target_device = ""; public string cmd_backup_device = ""; public string cmd_snapshot = ""; + public string cmd_config = ""; public bool cmd_confirm = false; public bool cmd_verbose = true; public bool cmd_scripted = false; @@ -295,7 +296,7 @@ public class Main : GLib.Object{ string local_exec = args[0]; string local_conf = app_path + "/timeshift.json"; string local_share = app_path + "/share"; - + log_msg("cmd_config" + ": " + cmd_config); var f_local_exec = File.new_for_path(local_exec); if (f_local_exec.query_exists()){ @@ -313,6 +314,10 @@ public class Main : GLib.Object{ //timeshift is running from system directory - update app_path this.app_path = get_cmd_path("timeshift"); } + var f_config_path = File.new_for_path(cmd_config); + if (f_config_path.query_exists()){ + this.app_conf_path = cmd_config; + } // initialize lists ----------------- @@ -491,6 +496,9 @@ public class Main : GLib.Object{ case "--list-devices": app_mode = "list-devices"; break; + case "--config": + cmd_config = args[++k]; + break; } } } @@ -602,6 +610,7 @@ public class Main : GLib.Object{ if (entry.mount_point.has_prefix("/srv")){ continue; } if (entry.mount_point.has_prefix("/sys")){ continue; } if (entry.mount_point.has_prefix("/system")){ continue; } + if (entry.mount_point.has_prefix("/work")){ continue; } if (entry.mount_point.has_prefix("/tmp")){ continue; } if (entry.mount_point.has_prefix("/usr")){ continue; } if (entry.mount_point.has_prefix("/var")){ continue; } diff --git a/src/meson.build b/src/meson.build index def2ce5d..8f503663 100644 --- a/src/meson.build +++ b/src/meson.build @@ -109,6 +109,10 @@ timeshift_gtk = executable('timeshift-gtk', install: true ) +install_data( + sources : 'timeshift-gtk-env', + install_dir : get_option('bindir') +) install_data( sources : 'timeshift-launcher', install_dir : get_option('bindir') diff --git a/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy b/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy new file mode 100644 index 00000000..7f6c377b --- /dev/null +++ b/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy @@ -0,0 +1,20 @@ + + + + Tony George + https://github.com/teejee2008 + + Timeshift + Run Timeshift as Administrator + timeshift + + auth_admin + auth_admin + auth_admin + + /usr/bin/timeshift-gtk-env + true + + diff --git a/src/timeshift-gtk-env b/src/timeshift-gtk-env new file mode 100755 index 00000000..8a2e6205 --- /dev/null +++ b/src/timeshift-gtk-env @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +export DISPLAY=$DISPLAY +export XAUTHORITY=$XAUTHORITY +timeshift-gtk \ No newline at end of file diff --git a/src/timeshift-launcher b/src/timeshift-launcher index b121bd5e..93a5cc84 100755 --- a/src/timeshift-launcher +++ b/src/timeshift-launcher @@ -1,6 +1,6 @@ #!/usr/bin/env bash -app_command='timeshift-gtk' +app_command='timeshift-gtk-env' if [ "$(id -u)" -eq 0 ]; then # user is admin From b8a616cda783e8901d6f1dc8610a5c8fd3fd896c Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 28 May 2025 16:27:26 +0000 Subject: [PATCH 2/8] upgrade version --- .gitignore | 1 + meson.build | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d8394ae4..a9dabf7f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ release/*.run .idea build builddir +rust po-lp/ parts/ stage/ diff --git a/meson.build b/meson.build index 2caf41f4..1066eda6 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'timeshift', 'vala', 'c', - version : '24.06.6', + version : '24.06.7', license : 'GPL-2.0-or-later', meson_version : '>= 0.54.0', default_options : ['c_std=c99', 'build.c_std=c99'] From 43e1926364d0bb51a9474bf38f3881d49006f2b3 Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 28 May 2025 16:45:14 +0000 Subject: [PATCH 3/8] upgrade version --- docs/development.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/development.md b/docs/development.md index ea5a1474..8f7999eb 100644 --- a/docs/development.md +++ b/docs/development.md @@ -69,19 +69,9 @@ sudo ninja uninstall tar czvf ../timeshift_24.02.1.orig.tar.gz --exclude='*.git' --exclude='.gitignore' --exclude='build' --exclude='*.swp' --exclude='*.orig' --exclude='*.rej' --exclude='*.bak' --exclude='*.gz' --exclude='*.xz' --exclude='*.bz2' --exclude='*.lzma' --exclude='debian' --exclude='archlinux' * ``` -#### Add changelog -``` -timeshift (24.02.1-1) unstable; urgency=medium - - * 24.02.1-1 unstable minor bug fixes - - -- Jiang Meng Sun, 18 Aug 2024 20:51:22 +0800 -``` - #### Commit your code & merge to the source tree ```bash git commit -a -m "fixed issues" -dpkg-source --commit ``` #### Package From e47a9ba072088f461b2575264a2aef3c0d18d754 Mon Sep 17 00:00:00 2001 From: jay Date: Tue, 3 Jun 2025 15:16:33 +0000 Subject: [PATCH 4/8] update descriptions --- debian/changelog | 6 ++++++ docs/development.md | 12 +----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3f05a454..d896b185 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +timeshift (24.06.7) xia; urgency=medium + + * Added supported for multiple configuration files + + -- Jiang Meng(Jay) Tue, 03 Jun 2025 23:15:15 +0000 + timeshift (24.06.6) xia; urgency=medium * l10n: Update translations diff --git a/docs/development.md b/docs/development.md index 8f7999eb..6af1d0ed 100644 --- a/docs/development.md +++ b/docs/development.md @@ -63,18 +63,8 @@ sudo ninja uninstall ``` ### Step 5. Build the debian package - -#### Package source code -```bash -tar czvf ../timeshift_24.02.1.orig.tar.gz --exclude='*.git' --exclude='.gitignore' --exclude='build' --exclude='*.swp' --exclude='*.orig' --exclude='*.rej' --exclude='*.bak' --exclude='*.gz' --exclude='*.xz' --exclude='*.bz2' --exclude='*.lzma' --exclude='debian' --exclude='archlinux' * -``` - -#### Commit your code & merge to the source tree -```bash -git commit -a -m "fixed issues" -``` - #### Package ```bash +sudo apt install debhelper-compat=10 dpkg-buildpackage -us -uc ``` \ No newline at end of file From 28937bec933df4d4bf5900981c1b754e3162aab1 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Tue, 26 Aug 2025 18:02:54 +0200 Subject: [PATCH 5/8] 25.0.7 --- debian/changelog | 6 ++++++ meson.build | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 060cba42..04dc82fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +timeshift (25.07.7) zara; urgency=medium + + * l10n: Update translations + + -- Clement Lefebvre Tue, 26 Aug 2025 18:02:04 +0200 + timeshift (25.07.6) zara; urgency=medium [ Michael Webster ] diff --git a/meson.build b/meson.build index 8aaa6264..91aa001b 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'timeshift', 'vala', 'c', - version : '25.07.6', + version : '25.07.7', license : 'GPL-2.0-or-later', meson_version : '>= 0.54.0', default_options : ['c_std=c99', 'build.c_std=c99'] From a63dc32c983b9b15c01783f057cc78ea7a6d3157 Mon Sep 17 00:00:00 2001 From: jay Date: Thu, 28 Aug 2025 23:25:35 +0800 Subject: [PATCH 6/8] remove .vscode --- .vscode/launch.json | 26 -------------------------- .vscode/settings.json | 6 ------ .vscode/tasks.json | 31 ------------------------------- 3 files changed, 63 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index fcd13361..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "(gdb) Launch", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/build/src/timeshift", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build", - "miDebuggerPath": "/usr/bin/gdb" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 2dde3203..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "C_Cpp.default.compileCommands": "/work/linux-workspace/timeshift/build/compile_commands.json", - "C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild", - "mesonbuild.buildFolder": "build", - "vala.languageServerPath": "/usr/local/bin/vala-language-server", -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index a2947db0..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "type": "shell", - "command": "meson setup --reconfigure ${workspaceFolder}/build -Ddebug=true && meson compile -C ${workspaceFolder}/build", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - }, - { - "label": "run-gdbserver", - "type": "shell", - "command": "gdbserver localhost:12345 ${workspaceFolder}/build/src/timeshift", - "problemMatcher": [] - }, - { - "label": "clean", - "type": "shell", - "command": "meson compile -C ${workspaceFolder}/build", - "group": { - "kind": "build", - "isDefault": false - }, - "problemMatcher": [] - } - ] -} \ No newline at end of file From 11cf361d329a07dc03b94fa18f01297c0153e2d2 Mon Sep 17 00:00:00 2001 From: jay Date: Thu, 28 Aug 2025 23:53:57 +0800 Subject: [PATCH 7/8] remove scdoc --- docs/development.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index 6af1d0ed..149ac412 100644 --- a/docs/development.md +++ b/docs/development.md @@ -21,7 +21,6 @@ sudo apt install meson \ help2man \ gettext \ valac \ -scdoc \ libvala-dev \ libvte-2.91-dev \ libgee-0.8-dev \ From 64f02fa5592302b27802cf61f9f451451a301b6a Mon Sep 17 00:00:00 2001 From: jay Date: Fri, 29 Aug 2025 01:08:52 +0800 Subject: [PATCH 8/8] removed timeshift-gtk-env --- src/meson.build | 4 ---- ...teejeetech.pkexec.timeshift-default.policy | 20 ------------------- src/timeshift-gtk-env | 4 ---- src/timeshift-launcher | 10 +++++++--- 4 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy delete mode 100755 src/timeshift-gtk-env diff --git a/src/meson.build b/src/meson.build index 8f503663..def2ce5d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -109,10 +109,6 @@ timeshift_gtk = executable('timeshift-gtk', install: true ) -install_data( - sources : 'timeshift-gtk-env', - install_dir : get_option('bindir') -) install_data( sources : 'timeshift-launcher', install_dir : get_option('bindir') diff --git a/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy b/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy deleted file mode 100644 index 7f6c377b..00000000 --- a/src/share/polkit-1/actions/in.teejeetech.pkexec.timeshift-default.policy +++ /dev/null @@ -1,20 +0,0 @@ - - - - Tony George - https://github.com/teejee2008 - - Timeshift - Run Timeshift as Administrator - timeshift - - auth_admin - auth_admin - auth_admin - - /usr/bin/timeshift-gtk-env - true - - diff --git a/src/timeshift-gtk-env b/src/timeshift-gtk-env deleted file mode 100755 index 8a2e6205..00000000 --- a/src/timeshift-gtk-env +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -export DISPLAY=$DISPLAY -export XAUTHORITY=$XAUTHORITY -timeshift-gtk \ No newline at end of file diff --git a/src/timeshift-launcher b/src/timeshift-launcher index 8f925a66..111f9ac7 100755 --- a/src/timeshift-launcher +++ b/src/timeshift-launcher @@ -1,6 +1,6 @@ #!/usr/bin/env bash -app_command='timeshift-gtk-env' +app_command='timeshift-gtk' if [ "$(id -u)" -eq 0 ]; then # user is admin @@ -14,11 +14,15 @@ else # script is running in non-interactive mode if [ "$XDG_SESSION_TYPE" = "wayland" ] ; then xhost +SI:localuser:root - pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ${app_command} + export DISPLAY=$DISPLAY + export XAUTHORITY=$XAUTHORITY + pkexec ${app_command} xhost -SI:localuser:root xhost elif command -v pkexec >/dev/null 2>&1; then - pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ${app_command} + export DISPLAY=$DISPLAY + export XAUTHORITY=$XAUTHORITY + pkexec ${app_command} elif command -v sudo >/dev/null 2>&1; then x-terminal-emulator -e "sudo ${app_command}" elif command -v su >/dev/null 2>&1; then