Skip to content

Commit

Permalink
Display an error if home path is not valid for a subvolume
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Feb 6, 2019
1 parent 9a181e8 commit 0e948f1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/include/users/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ def EditUserDialog(what)
no_skel = Convert.to_boolean(UI.QueryWidget(Id(:skel), :Value))
mode = Convert.to_string(UI.QueryWidget(Id(:mode), :Value))
end

if Ops.add(Builtins.findlastof(new_home, "/"), 1) ==
Builtins.size(new_home)
new_home = Builtins.substring(
Expand Down Expand Up @@ -1533,6 +1534,22 @@ def EditUserDialog(what)
create_home = false
end

# A flag to decide if the Btrfs path validation should be performed, since it is not
# needed when moving it to other location. The "create_home" above is not reliable because
# it is "true" **when moving the directory/subvolume**.
check_btrfs_path = !UI.QueryWidget(Id(:move_home), :Value)

# Check if is a valid path when creating a Btfs subvolume
if btrfs_subvolume && check_btrfs_path && !valid_btrfs_path?(new_home)
Report.Error(
_("Given path is not a valid Btrfs location.\n\n" \
"Choose another path for the home directory\n" \
"or uncheck the 'Btrfs subvolume' option.")
)
focus_tab.call(current, :home)
next
end

home = new_home
shell = new_shell
uid = new_i_uid
Expand Down

0 comments on commit 0e948f1

Please sign in to comment.