@@ -50,6 +50,7 @@ public class Main : GLib.Object{
5050 public string backup_parent_uuid = " " ;
5151
5252 public bool btrfs_mode = true ;
53+ public bool btrfs_readonly = true ;
5354 public bool include_btrfs_home_for_backup = false ;
5455 public bool include_btrfs_home_for_restore = false ;
5556
@@ -1654,7 +1655,7 @@ public class Main : GLib.Object{
16541655 dst_path = dst_path. replace(" /@home/@home" , " /@home" );
16551656 }
16561657
1657- string cmd = " btrfs subvolume snapshot '%s ' '%s ' \n " . printf(src_path, dst_path);
1658+ string cmd = " btrfs subvolume snapshot '%s ' '%s ' ' %s ' \n " . printf(btrfs_readonly ? " -r " : " " , src_path, dst_path);
16581659
16591660 if (LOG_COMMANDS ) { log_debug(cmd); }
16601661
@@ -1683,7 +1684,7 @@ public class Main : GLib.Object{
16831684 // write control file
16841685 var snapshot = Snapshot . write_control_file(
16851686 snapshot_path, dt_created, sys_uuid, current_distro. full_name(),
1686- initial_tags, cmd_comments, 0 , true , false , repo);
1687+ initial_tags, btrfs_readonly ? " ReadOnly " : cmd_comments, 0 , true , false , repo);
16871688
16881689 // write subvolume info
16891690 foreach (var subvol in sys_subvolumes. values){
@@ -3207,6 +3208,7 @@ public class Main : GLib.Object{
32073208
32083209 config. set_string_member(" do_first_run" , false . to_string());
32093210 config. set_string_member(" btrfs_mode" , btrfs_mode. to_string());
3211+ config. set_string_member(" btrfs_readonly" , btrfs_readonly. to_string());
32103212 config. set_string_member(" include_btrfs_home_for_backup" , include_btrfs_home_for_backup. to_string());
32113213 config. set_string_member(" include_btrfs_home_for_restore" , include_btrfs_home_for_restore. to_string());
32123214 config. set_string_member(" stop_cron_emails" , stop_cron_emails. to_string());
@@ -3304,6 +3306,8 @@ public class Main : GLib.Object{
33043306 bool do_first_run = json_get_bool(config, " do_first_run" , false ); // false as default
33053307
33063308 btrfs_mode = json_get_bool(config, " btrfs_mode" , false ); // false as default
3309+
3310+ btrfs_readonly = json_get_bool(config, " btrfs_readonly" , true ); // true as default
33073311
33083312 if (do_first_run){
33093313 set_first_run_flag();
0 commit comments