diff -Nru aptik-18.5.1/debian/changelog aptik-18.5.2/debian/changelog --- aptik-18.5.1/debian/changelog 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/debian/changelog 2018-05-12 05:04:34.000000000 +0000 @@ -1,9 +1,24 @@ -aptik (18.5.1-0~201805031832~ubuntu18.10.1) cosmic; urgency=low +aptik (18.5.2-0~201805120407~ubuntu18.10.1) cosmic; urgency=low * Auto build. - -- Tony George Thu, 03 May 2018 18:39:08 +0000 + -- Tony George Sat, 12 May 2018 05:04:34 +0000 +aptik (18.5.2) xenial; urgency=medium + + * Added commands: --exec-scripts, --list-scripts, --list-files + + * Fixed: Do not report error if user's crontab is empty + + * Fixed: Do not report error if user's dconf db has no changes + + * Fixed: Install package xz on Arch Linux instead of xz-utils + + * Fixed: Repos are sometimes listed twice + + -- Tony George Sat, 12 May 2018 10:00:00 +0530 + + aptik (18.5.1) xenial; urgency=medium * Fixed: Empty package list on systems having non-english locale diff -Nru aptik-18.5.1/debian/git-build-recipe.manifest aptik-18.5.2/debian/git-build-recipe.manifest --- aptik-18.5.1/debian/git-build-recipe.manifest 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/debian/git-build-recipe.manifest 2018-05-12 05:04:34.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version {debupstream}-0~201805031832 -lp:aptik-github git-commit:849fe019d3584ed169f2afe1aefd9b036367696e +# git-build-recipe format 0.4 deb-version {debupstream}-0~201805120407 +lp:aptik-github git-commit:bcb792618838ceef05bb4dcbbab7b2f0d2b1202f diff -Nru aptik-18.5.1/release/sanity.config aptik-18.5.2/release/sanity.config --- aptik-18.5.1/release/sanity.config 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/release/sanity.config 2018-05-12 05:04:34.000000000 +0000 @@ -1,7 +1,7 @@ app_name: Aptik depends_debian: libgee-0.8-2 libjson-glib-1.0-0 apt aptitude apt-transport-https pv xz-utils depends_redhat: libgee json-glib pv xz-utils -depends_arch: libgee json-glib pv xz-utils +depends_arch: libgee json-glib pv xz depends_generic: libgee json-glib pv xz-utils assume_yes: 0 -shexec_line: pkexec aptik +exec_line: aptik diff -Nru aptik-18.5.1/src/Console/AptikConsole.vala aptik-18.5.2/src/Console/AptikConsole.vala --- aptik-18.5.1/src/Console/AptikConsole.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/AptikConsole.vala 2018-05-12 05:04:34.000000000 +0000 @@ -32,7 +32,7 @@ public const string AppName = "Aptik"; public const string AppShortName = "aptik"; -public const string AppVersion = "18.5.1"; +public const string AppVersion = "18.5.2"; public const string AppAuthor = "Tony George"; public const string AppAuthorEmail = "teejeetech@gmail.com"; @@ -211,7 +211,7 @@ } } else{ - log_error("not_found: %s".printf(list_file)); + log_debug("not_found: %s".printf(list_file)); } return list; @@ -421,6 +421,13 @@ msg += "%s:\n".printf(_("Options")); msg += fmt.printf("--add ", _("Add file or directory to backups")); msg += "\n"; + + msg += fmt2.printf(Messages.TASK_SCRIPTS); + + msg += "%s:\n".printf(_("Commands")); + msg += fmt.printf("--list-scripts", _("List scripts from backup")); + msg += fmt.printf("--exec-scripts", _("Execute scripts from backup")); + msg += "\n"; msg += fmt2.printf(_("All Items")); @@ -714,10 +721,18 @@ case "--backup-cron": case "--restore-cron": + case "--dump-files": + case "--dump-files-backup": case "--list-files": case "--backup-files": case "--restore-files": + case "--dump-scripts": + case "--dump-scripts-backup": + case "--list-scripts": + case "--exec-scripts": + case "--restore-scripts": + case "--backup-all": case "--restore-all": case "--remove-all": @@ -1003,7 +1018,7 @@ log_msg("basepath='%s'".printf(basepath)); return restore_mount_entries(); - // dconf settings ------------------------------------------- + // dconf ------------------------------------------- case "--dump-dconf": return dump_dconf(); @@ -1022,7 +1037,7 @@ log_msg("basepath='%s'".printf(basepath)); return restore_dconf_settings(); - // cron tasks ------------------------------------------- + // cron ------------------------------------------- case "--dump-cron": return dump_cron(); @@ -1041,8 +1056,14 @@ log_msg("basepath='%s'".printf(basepath)); return restore_cron_tasks(); - // file tasks ------------------------------------------- + // files ------------------------------------------- + + case "--dump-files": + return dump_files(); + case "--dump-files-backup": + return dump_files_backup(); + case "--list-files": log_msg("basepath='%s'".printf(basepath)); return list_files(); @@ -1054,7 +1075,24 @@ case "--restore-files": log_msg("basepath='%s'".printf(basepath)); return restore_files(); - + + // scripts ------------------------------------------- + + case "--dump-scripts": + return dump_scripts(); + + case "--dump-scripts-backup": + return dump_scripts_backup(); + + case "--list-scripts": + log_msg("basepath='%s'".printf(basepath)); + return list_scripts(); + + case "--exec-scripts": + case "--restore-scripts": + log_msg("basepath='%s'".printf(basepath)); + return execute_scripts(); + // all --------------------------------------------- case "--backup-all": @@ -1251,7 +1289,7 @@ public void check_basepath(){ if (!dir_exists(basepath)){ - log_error(_("Backup directory not found") + ": '%s'".printf(basepath)); + log_msg("%s: %s".printf(Messages.DIR_MISSING, basepath)); exit(1); } } @@ -2040,7 +2078,7 @@ return status; } - // mounts ----------------------------- + // dconf ----------------------------- public bool dump_dconf(){ @@ -2102,7 +2140,7 @@ return status; } - // cron tasks ----------------------------- + // cron ----------------------------- public bool dump_cron(){ @@ -2167,6 +2205,43 @@ // files ---------------- + public bool dump_files(){ + + return dump_files_backup(); + } + + public bool dump_files_backup(){ + + //check_admin_access(); + + string txt = ""; + + var files_path = path_combine(basepath, "files"); + + var data_path = path_combine(files_path, "data"); + + var files = dir_list_names(data_path, true); + + foreach(string f in files){ + + txt += "NAME='%s'".printf(file_basename(f)); + + string sz = format_file_size(file_get_size(f)); + + txt += ",DESC='%s'".printf(sz); + + txt += ",ACT='%s'".printf("0"); + + txt += ",SENS='%s'".printf("1"); + + txt += "\n"; + } + + log_msg(txt); + + return true; + } + public bool list_files(){ //check_admin_access(); @@ -2193,7 +2268,7 @@ } } else{ - log_msg("%s: %s".printf(_("directory not found"), data_path)); + log_msg("%s: %s".printf(Messages.DIR_MISSING, data_path)); log_msg(string.nfill(70,'-')); } @@ -2235,9 +2310,11 @@ string tar_file_name = src_path.replace("/","_") + ".tar." + (use_xz ? "xz" : "gz"); UserHomeDataManager.zip_archive(src_path, data_path, tar_file_name); + + log_msg(string.nfill(70,'-')); } else{ - log_msg("%s: %s".printf(_("directory not found"), data_path)); + log_msg("%s: %s".printf(Messages.DIR_MISSING, data_path)); log_msg(string.nfill(70,'-')); } @@ -2270,7 +2347,7 @@ } } else{ - log_msg("%s: %s".printf(_("directory not found"), data_path)); + log_msg("%s: %s".printf(Messages.DIR_MISSING, data_path)); //log_msg(string.nfill(70,'-')); } @@ -2298,17 +2375,110 @@ // scripts -------------- + public bool dump_scripts(){ + + return dump_scripts_backup(); + } + + public bool dump_scripts_backup(){ + + //check_admin_access(); + + string txt = ""; + + var scripts_path = path_combine(basepath, "scripts"); + + var files_path = path_combine(scripts_path, "files"); + + var files = dir_list_names(files_path, true); + + foreach(string f in files){ + + txt += "NAME='%s'".printf(file_basename(f)); + + string desc = ""; + foreach(var line in file_read(f).split("\n")){ + if (line.strip().has_prefix("# aptik-desc:")){ + desc = line.split("# aptik-desc:")[1].strip(); + } + } + + txt += ",DESC='%s'".printf(desc); + + txt += ",ACT='%s'".printf("0"); + + txt += ",SENS='%s'".printf("1"); + + txt += "\n"; + } + + log_msg(txt); + + return true; + } + + public bool list_scripts(){ + + //check_admin_access(); + + var scripts_path = path_combine(basepath, "scripts"); + + var files_path = path_combine(scripts_path, "files"); + + if (dir_exists(files_path)){ + + var files = dir_list_names(files_path, true); + + if (files.size > 0){ + + log_msg(string.nfill(70,'-')); + + foreach(var file in files){ + + string desc = ""; + foreach(var line in file_read(file).split("\n")){ + if (line.strip().has_prefix("# aptik-desc:")){ + desc = line.split("# aptik-desc:")[1].strip(); + } + } + + string txt = file_basename(file); + + txt += file_basename(file).has_suffix("~") ? " (%s)".printf(_("disabled")) : ""; + + if (desc.length > 0){ + txt += " -- %s".printf(desc); + } + + log_msg(txt); + } + } + else{ + log_msg(_("No scripts found")); + log_msg(string.nfill(70,'-')); + } + } + else{ + log_msg("%s: %s".printf(Messages.DIR_MISSING, files_path)); + log_msg(string.nfill(70,'-')); + } + + return true; + } + public bool execute_scripts(){ - var scripts_path = path_combine(basepath,"scripts"); + var scripts_path = path_combine(basepath, "scripts"); + + var files_path = path_combine(scripts_path, "files"); log_msg(string.nfill(70,'-')); log_msg("%s:".printf(_("Execute Post-Restore Scripts"))); log_msg(string.nfill(70,'-')); - if (dir_exists(scripts_path)){ + if (dir_exists(files_path)){ - var files = dir_list_names(scripts_path, true); + var files = dir_list_names(files_path, true); files.sort(); if (files.size > 0){ @@ -2324,29 +2494,29 @@ scripts_found = true; chmod(file, "a+x"); - log_msg("%s: %s\n".printf(_("Executed"), file)); + log_msg("%s: %s\n".printf(_("Execute"), file_basename(file))); Posix.system("sh '%s'".printf(escape_single_quote(file))); log_msg(string.nfill(70,'-')); } if (!scripts_found){ - log_msg(_("no scripts found")); + log_msg(_("No scripts found")); } } else{ - log_msg(_("no scripts found")); + log_msg(_("No scripts found")); //log_msg(string.nfill(70,'-')); } } else{ - log_msg(_("scripts directory not found")); + log_msg("%s: %s".printf(Messages.DIR_MISSING, files_path)); //log_msg(string.nfill(70,'-')); } return true; } - public bool copy_scripts_for_dist(){ + public bool copy_scripts_for_dist2(){ string src = path_combine(file_parent(basepath), "scripts"); string dst = path_combine(basepath, "scripts"); @@ -2359,7 +2529,7 @@ Posix.system(cmd); - log_msg(_("copied scripts to distribution directory")); + log_msg(_("Copied scripts to distribution directory")); log_msg(string.nfill(70,'-')); return true; diff -Nru aptik-18.5.1/src/Console/CronTaskManager.vala aptik-18.5.2/src/Console/CronTaskManager.vala --- aptik-18.5.1/src/Console/CronTaskManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/CronTaskManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -208,11 +208,14 @@ if (status == 0){ log_msg("%s: (%s) %s".printf(_("Saved"), user.name, backup_file.replace(basepath, "$basepath"))); } - else{ - log_error("%s (%s) %s".printf(_("Error"), user.name, backup_file.replace(basepath, "$basepath"))); - } - return (status == 0); + // ignore errors (crontab may be empty for some users) ---------- + + //else{ + /// log_error("%s (%s) %s".printf(_("Error"), user.name, backup_file.replace(basepath, "$basepath"))); + //} + + return true; } public string save_exclude_list(){ diff -Nru aptik-18.5.1/src/Console/DconfManager.vala aptik-18.5.2/src/Console/DconfManager.vala --- aptik-18.5.1/src/Console/DconfManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/DconfManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -141,6 +141,8 @@ update_permissions_for_backup_files(); + log_msg(""); + if (status){ log_msg(Messages.BACKUP_OK); } @@ -174,16 +176,19 @@ if (ok){ log_msg("%s: (%s) %s".printf(_("Saved"), user.name, backup_file.replace(basepath, "$basepath"))); } - else { - status = false; - log_error("%s: (%s) %s".printf(_("Error"), user.name, backup_file.replace(basepath, "$basepath"))); - } + + // ignore errrors (dconf db may be empty for some users) ---------- + + //else { + // status = false; + // log_error("%s: (%s) %s".printf(_("Error"), user.name, backup_file.replace(basepath, "$basepath"))); + //} } else{ log_error(std_err); } - return status; + return true; } // restore ------------ diff -Nru aptik-18.5.1/src/Console/PackageCacheManager.vala aptik-18.5.2/src/Console/PackageCacheManager.vala --- aptik-18.5.1/src/Console/PackageCacheManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/PackageCacheManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -200,7 +200,7 @@ update_permissions_for_backup_files(); - log_msg(string.nfill(70,'-')); + //log_msg(string.nfill(70,'-')); log_msg(Messages.BACKUP_OK); return (status == 0); @@ -217,7 +217,7 @@ string backup_cache = path_combine(files_path, distro.dist_type); if (!dir_exists(backup_cache)){ - log_error("%s: %s".printf(_("Directory not found"), backup_cache)); + log_error("%s: %s".printf(Messages.DIR_MISSING, backup_cache)); return false; } diff -Nru aptik-18.5.1/src/Console/PackageManager.vala aptik-18.5.2/src/Console/PackageManager.vala --- aptik-18.5.1/src/Console/PackageManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/PackageManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -566,7 +566,10 @@ if (pkg.name.has_prefix("linux-signed")){ continue; } if (pkg.name.has_prefix("linux-tools")){ continue; } if (pkg.name.has_prefix("linux-image")){ continue; } - + if (pkg.name.has_prefix("linux-gcp-tools")){ continue; } + if (pkg.name.has_prefix("linux-oem-tools")){ continue; } + if (pkg.name.has_prefix("linux-hwe-edge-tools")){ continue; } + bool selected = true; if (auto_installed_known && pkg.is_auto){ selected = false; } @@ -930,7 +933,10 @@ if (pkg.name.has_prefix("linux-signed")){ continue; } if (pkg.name.has_prefix("linux-tools")){ continue; } if (pkg.name.has_prefix("linux-image")){ continue; } - + if (pkg.name.has_prefix("linux-gcp-tools")){ continue; } + if (pkg.name.has_prefix("linux-oem-tools")){ continue; } + if (pkg.name.has_prefix("linux-hwe-edge-tools")){ continue; } + if (exclude_list.contains(pkg.name)){ continue; } if (!include_list.contains(pkg.name)){ @@ -1505,10 +1511,11 @@ string? line = stdin.read_line(); counter.stop(); - line = (line != null) ? line.strip() : ""; + line = (line != null) ? line.strip().down() : ""; if (line != "y"){ log_msg("\nExiting. You can run same command again to continue restore."); + stdout.flush(); exit(1); } } diff -Nru aptik-18.5.1/src/Console/RepoManager.vala aptik-18.5.2/src/Console/RepoManager.vala --- aptik-18.5.1/src/Console/RepoManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/RepoManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -357,9 +357,9 @@ } } disabled = !has_lines; - } - txt += get_dump_line(name, desc, disabled); + txt += get_dump_line(name, desc, disabled); + } } log_msg(txt); diff -Nru aptik-18.5.1/src/Console/ThemeManager.vala aptik-18.5.2/src/Console/ThemeManager.vala --- aptik-18.5.1/src/Console/ThemeManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/ThemeManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -351,6 +351,8 @@ save_index(backup_path); + log_msg(""); + log_msg(Messages.BACKUP_OK); return false; diff -Nru aptik-18.5.1/src/Console/UserHomeDataManager.vala aptik-18.5.2/src/Console/UserHomeDataManager.vala --- aptik-18.5.1/src/Console/UserHomeDataManager.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Console/UserHomeDataManager.vala 2018-05-12 05:04:34.000000000 +0000 @@ -779,13 +779,15 @@ dir_create(dst_path); } + string comp_option = tar_file.has_suffix(".xz") ? "J" : "z"; + string cmd = ""; //cmd += "tar xzvf '%s' --directory='%s'".printf(tar_file, dst_path); cmd += "pv '%s'".printf(escape_single_quote(tar_file)); - cmd += " | tar xaf -"; + cmd += " | tar x%sf -".printf(comp_option); cmd += " -C '%s'".printf(escape_single_quote(dst_path)); diff -Nru aptik-18.5.1/src/Messages.vala aptik-18.5.2/src/Messages.vala --- aptik-18.5.1/src/Messages.vala 2018-05-03 18:39:08.000000000 +0000 +++ aptik-18.5.2/src/Messages.vala 2018-05-12 05:04:34.000000000 +0000 @@ -40,7 +40,7 @@ public const string DIR_CREATE_ERROR = _("Failed to create directory"); public const string DIR_EXISTS = _("Directory exists"); - public const string DIR_MISSING = _("Directory missing"); + public const string DIR_MISSING = _("Directory not found"); public const string USER_ADD_OK = _("User added"); public const string USER_ADD_ERROR = _("Failed to add user");