mirror of
https://github.com/linuxmint/timeshift.git
synced 2024-08-17 04:20:34 +03:00
fixed: some messages were not written to log; dependency check fails when run through cron job
This commit is contained in:
parent
78ceab0348
commit
668b128156
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
timeshift (1.0.2) quantal; urgency=low
|
||||
timeshift (1.0.3) quantal; urgency=low
|
||||
|
||||
* Rev:1, 2013-10-05
|
||||
|
||||
|
@ -120,6 +120,31 @@ public class Main : GLib.Object{
|
||||
public Main(string[] args){
|
||||
string msg = "";
|
||||
|
||||
//init log ------------------
|
||||
|
||||
try {
|
||||
DateTime now = new DateTime.now_local();
|
||||
log_dir = "/var/log/timeshift";
|
||||
log_file = log_dir + "/" + now.format("%Y-%m-%d %H-%M-%S") + ".log";
|
||||
|
||||
var file = File.new_for_path (log_dir);
|
||||
if (!file.query_exists ()) {
|
||||
file.make_directory_with_parents();
|
||||
}
|
||||
|
||||
file = File.new_for_path (log_file);
|
||||
if (file.query_exists ()) {
|
||||
file.delete ();
|
||||
}
|
||||
|
||||
dos_log = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION));
|
||||
log_msg(_("Session log file") + ": %s".printf(log_file));
|
||||
}
|
||||
catch (Error e) {
|
||||
is_success = false;
|
||||
log_error (e.message);
|
||||
}
|
||||
|
||||
//parse arguments (initial) ------------
|
||||
|
||||
parse_arguments(args);
|
||||
@ -149,9 +174,6 @@ public class Main : GLib.Object{
|
||||
Gtk.init (ref args);
|
||||
messagebox_show(_("Missing Dependencies"),message,true);
|
||||
}
|
||||
else{
|
||||
log_error(msg);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -184,31 +206,6 @@ public class Main : GLib.Object{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//init log ------------------
|
||||
|
||||
try {
|
||||
DateTime now = new DateTime.now_local();
|
||||
log_dir = "/var/log/timeshift";
|
||||
log_file = log_dir + "/" + now.format("%Y-%m-%d %H-%M-%S") + ".log";
|
||||
|
||||
var file = File.new_for_path (log_dir);
|
||||
if (!file.query_exists ()) {
|
||||
file.make_directory_with_parents();
|
||||
}
|
||||
|
||||
file = File.new_for_path (log_file);
|
||||
if (file.query_exists ()) {
|
||||
file.delete ();
|
||||
}
|
||||
|
||||
dos_log = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION));
|
||||
log_msg(_("Session log file") + ": %s".printf(log_file));
|
||||
}
|
||||
catch (Error e) {
|
||||
is_success = false;
|
||||
log_error (e.message);
|
||||
}
|
||||
|
||||
//initialize variables ------------------
|
||||
|
||||
this.app_path = (File.new_for_path (args[0])).get_parent().get_path ();
|
||||
@ -351,9 +348,9 @@ public class Main : GLib.Object{
|
||||
public bool check_dependencies(out string msg){
|
||||
msg = "";
|
||||
|
||||
string[] dependencies = { "rsync","blkid","df","du","mount","umount","fuser","crontab","cp","rm","touch","ln","sync","shutdown","chroot" };
|
||||
string[] dependencies = { "rsync","/sbin/blkid","df","du","mount","umount","fuser","crontab","cp","rm","touch","ln","sync",}; //"shutdown","chroot",
|
||||
|
||||
debug("Checking dependencies...");
|
||||
log_msg("Checking dependencies...");
|
||||
|
||||
string path;
|
||||
foreach(string cmd_tool in dependencies){
|
||||
@ -366,11 +363,12 @@ public class Main : GLib.Object{
|
||||
if (msg.length > 0){
|
||||
msg = _("Following dependencies are missing:") + "\n\n" + msg + "\n";
|
||||
msg += _("Please install the packages for the commands \nlisted above and try running TimeShift again.");
|
||||
debug("Missing dependencies");
|
||||
log_error(msg);
|
||||
log_error("Missing dependencies");
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
debug("All depenencies satisfied");
|
||||
log_msg("All dependencies satisfied");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,16 @@ public void debug (string message)
|
||||
if (DEBUG_MODE){
|
||||
log_msg (message);
|
||||
}
|
||||
else{
|
||||
try {
|
||||
if (dos_log != null){
|
||||
dos_log.put_string ("[%s] %s\n".printf(Utility.timestamp(), message));
|
||||
}
|
||||
}
|
||||
catch (Error e) {
|
||||
stdout.printf (e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Utility
|
||||
|
BIN
src/timeshift
BIN
src/timeshift
Binary file not shown.
@ -17,16 +17,17 @@ long_line_behaviour=1
|
||||
long_line_column=80
|
||||
|
||||
[files]
|
||||
current_page=1
|
||||
FILE_NAME_0=46254;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
current_page=0
|
||||
FILE_NAME_0=10291;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMain.vala;0;4
|
||||
FILE_NAME_1=15114;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FMainWindow.vala;0;4
|
||||
FILE_NAME_2=7729;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FSettingsWindow.vala;0;4
|
||||
FILE_NAME_3=14998;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FRestoreWindow.vala;0;4
|
||||
FILE_NAME_4=802;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FUtility.vala;0;4
|
||||
FILE_NAME_5=0;Make;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2Fmakefile;0;4
|
||||
FILE_NAME_6=516;Conf;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fdebian%2Fcontrol;0;4
|
||||
FILE_NAME_7=1145;None;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fbuild-installer;0;4
|
||||
FILE_NAME_8=2664;Sh;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Fmake-sfx%2Flib%2Fmake-sfx%2Fheader.sh;0;4
|
||||
FILE_NAME_4=12794;Vala;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2FUtility.vala;0;4
|
||||
FILE_NAME_5=794;Make;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fsrc%2Fmakefile;0;4
|
||||
FILE_NAME_6=925;Conf;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fdebian%2Fcontrol;0;4
|
||||
FILE_NAME_7=165;None;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fdebian%2Fchangelog;0;4
|
||||
FILE_NAME_8=1145;None;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Ftimeshift%2Fbuild-installer;0;4
|
||||
FILE_NAME_9=2864;Sh;0;16;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Fmake-sfx%2Flib%2Fmake-sfx%2Fheader.sh;0;4
|
||||
|
||||
[VTE]
|
||||
last_dir=/home/teejee
|
||||
|
Loading…
Reference in New Issue
Block a user