Module: Yast::PartitioningEpDialogsInclude
- Defined in:
- ../../src/include/partitioning/ep-dialogs.rb
Instance Method Summary (collapse)
- - (Object) ConfirmRecursiveDelete(device, devices, headline, text_before, text_after)
- - (Object) DisplayCommandOutput(command)
- - (Object) DlgResize(data, disk)
- - (Object) initialize_partitioning_ep_dialogs(include_target)
- - (Object) MiniWorkflowStepFormatMount(orig_data)
- - (Object) MiniWorkflowStepFormatMountHelptext
- - (Object) MiniWorkflowStepPassword(data)
- - (Object) MiniWorkflowStepPasswordHelptext(data)
- - (Object) MiniWorkflowStepRole(data)
- - (Object) MiniWorkflowStepRoleHelp
- - (Object) RescanDisks
Instance Method Details
- (Object) ConfirmRecursiveDelete(device, devices, headline, text_before, text_after)
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 1308 def ConfirmRecursiveDelete(device, devices, headline, text_before, text_after) devices = deep_copy(devices) = ButtonBox( PushButton(Id(:yes), Opt(:okButton), Label.DeleteButton), PushButton( Id(:no_button), Opt(:default, :cancelButton), Label.CancelButton ) ) display_info = UI.GetDisplayInfo has_image_support = Ops.get_boolean( display_info, "HasImageSupport", false ) layout = VBox( VSpacing(0.4), HBox( has_image_support ? Top(Image(Icon.IconPath("question"))) : Empty(), HSpacing(1), VBox( Left(Heading(headline)), VSpacing(0.2), Left(Label(text_before)), VSpacing(0.2), Left(RichText(HTML.List(Builtins.sort(devices)))), VSpacing(0.2), Left(Label(text_after)), ) ) ) UI.OpenDialog(layout) ret = Convert.to_symbol(UI.UserInput) UI.CloseDialog ret == :yes end |
- (Object) DisplayCommandOutput(command)
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 1261 def DisplayCommandOutput(command) # TODO: maybe use LogView.ycp, but here we want to wait until the command has finished # TODO: better error handling UI.OpenDialog( VBox( # label for log view MinWidth( 60, LogView( Id(:log), Builtins.sformat(_("Output of %1"), command), 15, 0 ) ), PushButton(Opt(:default), Label.CloseButton) ) ) tmp = Convert.to_map(SCR.Execute(path(".target.bash_output"), command)) lines = Ops.get_string(tmp, "stderr", "") != "" ? Ops.get_string(tmp, "stderr", "") : Ops.get_string(tmp, "stdout", "") UI.ChangeWidget(Id(:log), :Value, lines) UI.UserInput UI.CloseDialog nil end |
- (Object) DlgResize(data, disk)
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 862 def DlgResize(data, disk) disk = deep_copy(disk) # This resize dialog is simple but avoids several problems faced # before: # # - Stripped digits in a bargraph (bnc #445590) # # - Impossible to resize to maximal size (bnc #373744, #442318, # #456816) # # - Changing dialog size (bnc #460382) # # If somebody wants fancy stuff like slider or bargraph it's a # feature request. target_map = Storage.GetTargetMap possible = Storage.IsResizable(data.value) Builtins.y2milestone("DlgResize data: %1", data.value) txt = "" if !Ops.get(possible, "device", true) # popup text txt = _("Resize not supported by underlying device.") elsif !Ops.get_boolean(data.value, "format", false) && !Ops.get(possible, "shrink", false) && !Ops.get(possible, "extend", false) # popup text txt = _( "\n" + "You cannot resize the selected partition because the file system\n" + "on this partition does not support resizing.\n" ) end if !Builtins.isempty(txt) Popup.Message(txt) return false end cyl_size = 0 free_cyl_after = 0 device = Ops.get_string(data.value, "device", "error") used_fs = Ops.get_symbol(data.value, "used_fs", :none) used_k = FileSystems.MinFsSizeK(used_fs) if !Ops.get_boolean(data.value, "format", false) if used_fs != :swap if used_fs == :ntfs && !TryUmount( device, _( "It is not possible to check whether a NTFS\ncan be resized while it is mounted." ), false ) return false end free_data = Storage.GetFreeSpace(device, used_fs, true) if Builtins.isempty(free_data) || !Ops.get_boolean(free_data, "ok", false) Builtins.y2error( "Failed to retrieve FreeSpace %1, filesystem %2", device, Ops.get_symbol(data.value, "used_fs", :none) ) #FIXME: Really? Popup.Error( Builtins.sformat( _( "Partition %1 cannot be resized\nbecause the filesystem seems to be inconsistent.\n" ), device ) ) return false end used_k = Integer.Max( [used_k, Ops.divide(Ops.get_integer(free_data, "used", 0), 1024)] ) end end min_free_k = 10 * 1024 size_k = Ops.get_integer(data.value, "size_k", 0) # minimal and maximal size for volume min_size_k = Integer.Min([Ops.add(used_k, min_free_k), size_k]) max_size_k = 0 heading = "" case Ops.get_symbol(data.value, "type", :unknown) when :logical, :primary # Heading for dialog heading = Builtins.sformat(_("Resize Partition %1"), device) cyl_size = Ops.get_integer(disk, "cyl_size", 1) free_cyl_before = 0 free_cyl_before_ref = arg_ref(free_cyl_before) free_cyl_after_ref = arg_ref(free_cyl_after) Storage.FreeCylindersAroundPartition( device, free_cyl_before_ref, free_cyl_after_ref ) free_cyl_before = free_cyl_before_ref.value free_cyl_after = free_cyl_after_ref.value min_size_k = Integer.Max([min_size_k, Ops.divide(cyl_size, 1024)]) max_size_k = Ops.add( size_k, Ops.divide(Ops.multiply(cyl_size, free_cyl_after), 1024) ) when :lvm # Heading for dialog heading = Builtins.sformat(_("Resize Logical Volume %1"), device) min_size_k = Integer.Max( [min_size_k, Ops.divide(Ops.get_integer(disk, "pesize", 0), 1024)] ) max_size_k = Ops.add( size_k, Ops.divide( Ops.multiply( Ops.get_integer(disk, "pe_free", 0), Ops.get_integer(disk, "pesize", 0) ), 1024 ) ) end # size_k + min_size_k could be > max_size_k min_size_k = Integer.Min([min_size_k, max_size_k]) Builtins.y2milestone("used_k:%1 size_k:%2", used_k, size_k) Builtins.y2milestone( "min_size_k:%1 max_size_k:%2", min_size_k, max_size_k ) infos = VBox( Left( Label( Builtins.sformat( _("Current size: %1"), Storage.KByteToHumanString(size_k) ) ) ) ) if used_fs != :swap && !Ops.get_boolean(data.value, "format", false) infos = Builtins.add( infos, Left( Label( Builtins.sformat( _("Currently used: %1"), Storage.KByteToHumanString(used_k) ) ) ) ) end contents = HVSquash( # frame heading term( :FrameWithMarginBox, _("Size"), RadioButtonGroup( Id(:size), VBox( term( :LeftRadioButton, Id(:max_size), Opt(:notify), # radio button text, %1 is replaced by size Builtins.sformat( _("Maximum Size (%1)"), Storage.KByteToHumanString(max_size_k) ) ), term( :LeftRadioButton, Id(:min_size), Opt(:notify), # radio button text, %1 is replaced by size Builtins.sformat( _("Minimum Size (%1)"), Storage.KByteToHumanString(min_size_k) ) ), # radio button text term( :LeftRadioButtonWithAttachment, Id(:custom_size), Opt(:notify), _("Custom Size"), VBox( Id(:custom_size_attachment), MinWidth( 15, InputField( Id(:custom_size_input), Opt(:shrinkable), _("Size") ) ) ) ), VSpacing(1), infos ) ) ) ) UI.OpenDialog( VBox( Left(Heading(heading)), Greasemonkey.Transform(contents), VSpacing(1.0), ButtonBox( PushButton(Id(:help), Opt(:helpButton), Label.HelpButton), PushButton(Id(:cancel), Opt(:cancelButton), Label.CancelButton), PushButton(Id(:ok), Opt(:default, :okButton), Label.OKButton) ) ) ) # help text help_text = _("<p>Choose new size.</p>") UI.ChangeWidget(:help, :HelpText, help_text) UI.ChangeWidget(Id(:size), :Value, :max_size) UI.ChangeWidget(Id(:custom_size_attachment), :Enabled, false) UI.ChangeWidget( Id(:custom_size_input), :Value, Storage.KByteToHumanString(size_k) ) = nil asked_big_resize = false old_size_k = size_k begin = Convert.to_symbol(UI.UserInput) case when :max_size UI.ChangeWidget(Id(:custom_size_attachment), :Enabled, false) when :min_size UI.ChangeWidget(Id(:custom_size_attachment), :Enabled, false) when :custom_size UI.ChangeWidget(Id(:custom_size_attachment), :Enabled, true) UI.SetFocus(Id(:custom_size_input)) when :ok case Convert.to_symbol(UI.QueryWidget(Id(:size), :Value)) when :max_size size_k = max_size_k when :min_size size_k = min_size_k when :custom_size tmp = Convert.to_string( UI.QueryWidget(Id(:custom_size_input), :Value) ) if !( size_k_ref = arg_ref(size_k); _HumanStringToKByteWithRangeCheck_result = Storage.HumanStringToKByteWithRangeCheck( tmp, size_k_ref, min_size_k, max_size_k ); size_k = size_k_ref.value; _HumanStringToKByteWithRangeCheck_result ) # error popup, %1 and %2 are replaced by sizes Popup.Error( Builtins.sformat( _( "The size entered is invalid. Enter a size between %1 and %2." ), Storage.KByteToHumanString(min_size_k), Storage.KByteToHumanString(max_size_k) ) ) = :again next end end if size_k != old_size_k mountpoint = Storage.DeviceMounted(device) lvm = Ops.get_symbol(data.value, "type", :unknown) == :lvm if !Ops.get_boolean(data.value, "format", false) && !CheckResizePossible( device, false, lvm, Ops.subtract(size_k, old_size_k), used_fs ) #FIXME: To check whether the part. can be resized only #after user tries to do that is stupid - in some cases #we can tell beforehand, thus user should never get to this #point (e.g. when the partition is mounted) Builtins.y2error("Resizing the partition is not possible") = :again next end if !Ops.get_boolean(data.value, "format", false) && Ops.greater_than(Builtins.size(mountpoint), 0) && Builtins.contains([:ext2, :ext3, :ext4], used_fs) && !asked_big_resize && Ops.greater_or_equal( Ops.subtract(size_k, old_size_k), 1024 * 1024 * 50 ) asked_big_resize = true txt2 = Builtins.sformat( _( "You are extending a mounted filesystem by %1 Gigabyte. \n" + "This may be quite slow and can take hours. You might possibly want \n" + "to consider umounting the filesystem, which will increase speed of \n" + "resize task a lot." ), Ops.divide(Ops.subtract(size_k, old_size_k), 1024 * 1024) ) answ = Popup.YesNo(txt2) Builtins.y2milestone( "ResizeDlg big_resize_while_mounted ret:%1", answ ) if answ = :again next end end case Ops.get_symbol(data.value, "type", :unknown) when :logical, :primary @num_cyl = Builtins.tointeger( Ops.add( Ops.divide( Ops.multiply( 1024.0, Convert.convert( size_k, :from => "integer", :to => "float" ) ), Convert.convert( cyl_size, :from => "integer", :to => "float" ) ), 0.5 ) ) @num_cyl = Integer.Clamp( @num_cyl, 1, Ops.add( Ops.get_integer(data.value, ["region", 1], 0), free_cyl_after ) ) Ops.set(data.value, ["region", 1], @num_cyl) when :lvm Ops.set(data.value, "size_k", size_k) end end when :cancel end end while != :cancel && != :ok UI.CloseDialog == :ok end |
- (Object) initialize_partitioning_ep_dialogs(include_target)
29 30 31 32 33 34 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 29 def initialize_partitioning_ep_dialogs(include_target) textdomain "storage" Yast.include include_target, "partitioning/ep-lib.rb" Yast.include include_target, "partitioning/custom_part_lib.rb" end |
- (Object) MiniWorkflowStepFormatMount(orig_data)
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 133 def MiniWorkflowStepFormatMount(orig_data) data = orig_data.value d = Storage.GetDiskPartition(Ops.get_string(data, "device", "")) lbl = Ops.get_string( Storage.GetTargetMap, [Ops.get_string(d, "disk", ""), "label"], "" ) Builtins.y2milestone( "MiniWorkflowStepFormatMount label:%1 data:%2", lbl, data ) #retrieve all filesystems all_filesystems = FileSystems.GetAllFileSystems(true, true, lbl) if Ops.get_symbol(data, "type", :primary) == :btrfs # multi volume btrfs filesystem can only be formatted as btrfs all_filesystems = Convert.convert( Builtins.filter(all_filesystems) { |s, p| s == :btrfs }, :from => "map <symbol, map>", :to => "map <symbol, map <symbol, any>>" ) end if Ops.get_symbol(data, "type", :primary) == :tmpfs Ops.set(all_filesystems, :tmpfs, FileSystems.GetTmpfsFilesystem) end _ProposeMountpoints = lambda do |used_fs2, current_mp| fs_data = Ops.get(all_filesystems, used_fs2, {}) #not much choice for swap partitions :) if used_fs2 == :swap return Ops.get_list(fs_data, :mountpoints, []) else not_used = notUsedMountpoints( Storage.GetTargetMap, Ops.get_list(fs_data, :mountpoints, []) ) return Convert.convert( Builtins.union([current_mp], not_used), :from => "list", :to => "list <string>" ) end end # disable Options p.b. if no fs options can be set # disable Encrypt box if fs doesn't support encryption _EnableDisableFsOpts = lambda do |used_fs2| fs_data = Ops.get(all_filesystems, used_fs2, {}) ChangeWidgetIfExists( :fs_options, :Enabled, Ops.get_list(fs_data, :options, []) != [] ) ChangeWidgetIfExists( :crypt_fs, :Enabled, Ops.get_boolean(fs_data, :crypt, true) && Ops.get_symbol(data, "used_fs", :unknown) != :btrfs && !Ops.get_boolean(data, "pool", false) ) nil end do_format = Ops.get_boolean(data, "format", false) used_fs = Ops.get_symbol(data, "used_fs", :unknown) default_crypt_fs = Ops.get_symbol(data, "type", :unknown) == :loop ? :luks : :none crypt_fs = Ops.get_symbol(data, "enc_type", default_crypt_fs) != :none orig_crypt_fs = crypt_fs mount = Ops.get_string(data, "mount", "") do_mount = mount != "" if Ops.get_symbol(data, "type", :unknown) == :loop || Ops.get_symbol(data, "type", :unknown) == :tmpfs do_mount = true end _AskPassword = lambda do Builtins.y2milestone("AskPassword data:%1", data) ret = crypt_fs ret = do_format || orig_crypt_fs != crypt_fs || do_mount if ret if ret && !do_format key = Ops.get_symbol(data, "type", :unknown) != :loop ? Ops.get_string(data, "device", "error") : Ops.get_string(data, "fpath", "error") ret = Storage.NeedCryptPwd(key) end ret end # MiniWorkflowStepPartitionSize data: # $["create":true, # "cyl_size":8225280, # "device":"/dev/sda1", # "disk_device":"/dev/sda", # "new":true, # "slots":$[`primary:[1, 65]], # "type":`primary] #Supply some reasonable defaults for newly created partitions #and mark it for formatting, too if Ops.get_boolean(data, "new", false) && !Ops.get_boolean(data, "formatmount_proposed", false) Ops.set(data, "formatmount_proposed", true) role = data["role"] case role when :swap mount_point_proposal = "swap" used_fs = :swap data["format"] = true data["fsid"] = Partitions.fsid_swap data["ori_fsid"] = Partitions.fsid_swap data["used_fs"] = used_fs data["mount"] = mount_point_proposal when :raw mount_point_proposal = "" used_fs = :none data["format"] = false data["fsid"] = Partitions.fsid_lvm data["ori_fsid"] = Partitions.fsid_lvm data["used_fs"] = used_fs else # propose new mountpoint and filesystem mount_point_proposal = SingleMountPointProposal() used_fs = data["role"] == :system ? Partitions.DefaultFs() : Partitions.DefaultHomeFs() # special case for boot partition if mount_point_proposal == Partitions.BootMount used_fs = Partitions.DefaultBootFs end data["format"] = !Ops.get_boolean(data, "pool", false) data["fsid"] = Partitions.fsid_native data["ori_fsid"] = Partitions.fsid_native data["used_fs"] = used_fs data["mount"] = mount_point_proposal end # set globals do_format = Ops.get_boolean(data, "format", false) mount = mount_point_proposal do_mount = mount != "" if Ops.get_symbol(data, "type", :unknown) == :loop || Ops.get_symbol(data, "type", :unknown) == :tmpfs do_mount = true end end tmp1 = Empty() if Builtins.contains( [:primary, :extended, :logical], Ops.get_symbol(data, "type", :none) ) tmp1 = VBox( Id(:do_not_format_attachment), FsidComboBox(data, FileSystems.GetAllFileSystems(true, true, lbl)) ) end fmt = Empty() if Ops.get_symbol(data, "type", :none) != :tmpfs fmt = term( :FrameWithMarginBox, _("Formatting Options"), RadioButtonGroup( Id(:format), VBox( term( :LeftRadioButtonWithAttachment, Id(:do_format), Opt(:notify), _("Format partition"), VBox( Id(:do_format_attachment), FileSystemsComboBox(data, all_filesystems) ) ), VSpacing(0.45), term( :LeftRadioButtonWithAttachment, Id(:do_not_format), Opt(:notify), _("Do not format partition"), tmp1 ), VSpacing(0.45), CryptButton(data) ) ) ) end notmnt = Empty() if Ops.get_symbol(data, "type", :none) != :tmpfs notmnt = term( :LeftRadioButton, Id(:do_not_mount), Opt(:notify), _("Do not mount partition") ) end subvol = ReplacePoint( Id(:subvol_rp), SubvolPart(Ops.get_symbol(data, "used_fs", :unknown) == :btrfs) ) mountpoints = _ProposeMountpoints.call(used_fs, mount) contents = HVSquash( HBox( fmt, HSpacing(1), term( :VStackFrames, term( :FrameWithMarginBox, _("Mounting Options"), RadioButtonGroup( Id(:mount), VBox( term( :LeftRadioButtonWithAttachment, Id(:do_mount), Opt(:notify), _("Mount partition"), VBox( Id(:do_mount_attachment), ComboBox( Id(:mount_point), Opt(:editable, :hstretch, :notify), _("Mount Point"), mountpoints ), PushButton( Id(:fstab_options), Opt(:hstretch), # button text _("Fs&tab Options...") ) ) ), VSpacing(0.45), notmnt ) ) ), subvol, VStretch() ) ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepFormatMountHelptext() ) MiniWorkflow.SetLastStep(!_AskPassword.call) ChangeWidgetIfExists( :format, :Value, do_format ? :do_format : :do_not_format ) ChangeWidgetIfExists( :do_format, :Enabled, !Ops.get_boolean(data, "pool", false) ) ChangeWidgetIfExists(:do_format_attachment, :Enabled, do_format) #not there in RAID/LVM/loop configuration (#483789) ChangeWidgetIfExists(:do_not_format_attachment, :Enabled, !do_format) _EnableDisableFsOpts.call(used_fs) if do_format #not there on s390s ChangeWidgetIfExists(:crypt_fs, :Value, crypt_fs) ChangeWidgetIfExists( :crypt_fs, :Enabled, !Ops.get_boolean(data, "pool", false) ) UI.ChangeWidget(Id(:mount), :Value, do_mount ? :do_mount : :do_not_mount) ChangeWidgetIfExists( :do_mount, :Enabled, !Ops.get_boolean(data, "pool", false) ) UI.ChangeWidget(Id(:do_mount_attachment), :Enabled, do_mount) UI.ChangeWidget(Id(:mount_point), :Value, mount) = nil data = HandlePartWidgetChanges( true, , all_filesystems, orig_data.value, data ) begin = MiniWorkflow.UserInput if != :back && != :abort data = HandlePartWidgetChanges( false, , all_filesystems, orig_data.value, data ) end case when :fs used_fs = Convert.to_symbol(UI.QueryWidget(Id(:fs), :Value)) #retrieve info about fs user has selected used_fs_data = Ops.get(all_filesystems, used_fs, {}) Builtins.y2milestone("Selected filesystem details %1", used_fs_data) if used_fs != Ops.get_symbol(data, "used_fs", :none) #set file system type Ops.set(data, "used_fs", used_fs) data = Builtins.filter(data) { |key, value| key != "fs_options" } #set file system ID (and update the File System ID widget #that is - FsidComboBox) Ops.set( data, "fsid", Ops.get_integer(used_fs_data, :fsid, Partitions.fsid_native) ) UI.ChangeWidget( Id(:fsid_point), :Value, Ops.get_string(used_fs_data, :fsid_item, "") ) #suggest some nice mountpoints if user wants to mount this partition if do_mount UI.ChangeWidget( Id(:mount_point), :Items, _ProposeMountpoints.call(used_fs, mount) ) end end when :crypt_fs crypt_fs = Convert.to_boolean(UI.QueryWidget(Id(:crypt_fs), :Value)) MiniWorkflow.SetLastStep(!_AskPassword.call) when :do_format do_format = Convert.to_boolean( UI.QueryWidget(Id(:do_format), :Value) ) Ops.set( data, "used_fs", Convert.to_symbol(UI.QueryWidget(Id(:fs), :Value)) ) UI.ChangeWidget(Id(:do_format_attachment), :Enabled, true) ChangeWidgetIfExists(:do_not_format_attachment, :Enabled, false) _EnableDisableFsOpts.call(Ops.get_symbol(data, "used_fs", :none)) UI.SetFocus(Id(:fs)) MiniWorkflow.SetLastStep(!_AskPassword.call) when :do_not_format do_format = Convert.to_boolean( UI.QueryWidget(Id(:do_format), :Value) ) UI.ChangeWidget(Id(:do_format_attachment), :Enabled, false) ChangeWidgetIfExists(:do_not_format_attachment, :Enabled, true) MiniWorkflow.SetLastStep(!_AskPassword.call) when :fsid_point when :do_mount do_mount = true UI.ChangeWidget(Id(:do_mount_attachment), :Enabled, true) UI.SetFocus(Id(:mount_point)) #propose mountpoints #UI::ChangeWidget(`id(`mount_point), `Items, ProposeMountpoints( used_fs, mount )); MiniWorkflow.SetLastStep(!_AskPassword.call) when :do_not_mount do_mount = false UI.ChangeWidget(Id(:do_mount_attachment), :Enabled, false) MiniWorkflow.SetLastStep(!_AskPassword.call) when :next if UI.WidgetExists(Id(:do_format)) do_format = Convert.to_boolean( UI.QueryWidget(Id(:do_format), :Value) ) else do_format = true end if UI.WidgetExists(Id(:crypt_fs)) crypt_fs = Convert.to_boolean( UI.QueryWidget(Id(:crypt_fs), :Value) ) else crypt_fs = false end do_mount = Convert.to_boolean(UI.QueryWidget(Id(:do_mount), :Value)) mount = Convert.to_string(UI.QueryWidget(Id(:mount_point), :Value)) # TODO: checks #crypt-file specific checks if Ops.get_symbol(data, "type", :unknown) == :loop #is encrypt fs checked? if !crypt_fs # error popup Popup.Error(_("Crypt files must be encrypted.")) UI.ChangeWidget(Id(:crypt_fs), :Value, true) UI.SetFocus(Id(:crypt_fs)) = :again next end #enforce formatting the crypt-file if Ops.get_boolean(data, "create_file", false) && !do_format # error popup Popup.Error( _( "You chose to create the crypt file, but did not specify\n" + "that it should be formatted. This does not make sense.\n" + "\n" + "Also check the format option.\n" ) ) UI.ChangeWidget(Id(:do_format), :Value, true) UI.ChangeWidget(Id(:do_format_attachment), :Enabled, true) UI.SetFocus(Id(:fs)) = :again next end #enforce specifying mountpoint if !do_mount # error popup Popup.Error(_("Crypt files require a mount point.")) UI.ChangeWidget(Id(:do_mount), :Value, true) UI.ChangeWidget(Id(:do_mount_attachment), :Enabled, true) UI.SetFocus(Id(:mount_point)) = :again next end end #tmpfs specific checks if Ops.get_symbol(data, "type", :unknown) == :tmpfs #enforce specifying mountpoint if !do_mount # error popup Popup.Error(_("Tmpfs requires a mount point.")) UI.ChangeWidget(Id(:do_mount), :Value, true) UI.ChangeWidget(Id(:do_mount_attachment), :Enabled, true) UI.SetFocus(Id(:mount_point)) = :again next end end if do_mount ret_mp = CheckOkMount( Ops.get_string(data, "device", "error"), orig_data.value, data ) if !Ops.get_boolean(ret_mp, "ok", false) if Ops.get_symbol(ret_mp, "field", :none) != :none UI.SetFocus(Id(Ops.get_symbol(ret_mp, "field", :none))) end = :again next end end if do_format if !check_ok_fssize(Ops.get_integer(data, "size_k", 0), data) = :again next end end end end until == :abort || == :back || == :next if == :next if crypt_fs Ops.set( data, "enc_type", Ops.get_boolean(data, "format", false) ? :luks : :twofish ) else Ops.set(data, "enc_type", :none) end Ops.set(data, "format", do_format) Ops.set(data, "mount", do_mount ? mount : "") data = Builtins.filter(data) { |key, value| key != "fs_options" } if !Ops.get_boolean( data, "format", false ) if Builtins.contains( [:primary, :extended, :logical], Ops.get_symbol(data, "type", :unknown) ) if Ops.get_integer(data, "fsid", 0) != Ops.get_integer(orig_data.value, "fsid", 0) Ops.set(data, "change_fsid", true) end end = :finish if !_AskPassword.call orig_data.value = deep_copy(data) end Builtins.y2milestone( "MiniWorkflowStepFormatMount data:%1 ret:%2", data, ) end |
- (Object) MiniWorkflowStepFormatMountHelptext
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 105 def MiniWorkflowStepFormatMountHelptext # helptext helptext = _( "<p>First, choose whether the partition should be\nformatted and the desired file system type.</p>" ) # helptext helptext = Ops.add( helptext, _( "<p>If you want to encrypt all data on the\n" + "volume, select <b>Encrypt Device</b>. Changing the encryption on an existing\n" + "volume will delete all data on it.</p>\n" ) ) # helptext helptext = Ops.add( helptext, _( "<p>Then, choose whether the partition should\nbe mounted and enter the mount point (/, /boot, /home, /var, etc.).</p>" ) ) helptext end |
- (Object) MiniWorkflowStepPassword(data)
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 755 def MiniWorkflowStepPassword(data) Builtins.y2milestone("MiniWorkflowStepPassword data:%1", data.value) min_pw_len = Ops.get_boolean(data.value, "format", false) ? 8 : 1 empty_pw_allowed = EmptyCryptPwdAllowed(data.value) two_pw = Ops.get_boolean(data.value, "format", false) || Builtins.isempty(Ops.get_string(data.value, "mount", "")) label = "" if two_pw label = _("All data stored on the volume will be lost!") label = Ops.add(label, "\n") label = Ops.add(label, _("Do not forget what you enter here!")) label = Ops.add(label, "\n") end label = Ops.add(label, _("Empty password allowed.")) if empty_pw_allowed ad = Empty() if two_pw ad = Password( Id(:pw2), Opt(:hstretch), # Label: get same password again for verification # Please use newline if label is longer than 40 characters _("Reenter the Password for &Verification:"), "" ) end contents = HVSquash( term( :FrameWithMarginBox, _("Password"), VBox( Password( Id(:pw1), Opt(:hstretch), # Label: get password for user root # Please use newline if label is longer than 40 characters _("&Enter a Password for your File System:"), "" ), ad, VSpacing(0.5), Left(Label(label)) ) ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepPasswordHelptext(data.value) ) MiniWorkflow.SetLastStep(true) password = "" = nil #don't put those inside the loop - they'd be reset after each unsuccesful try UI.ChangeWidget(Id(:pw1), :Value, "") UI.ChangeWidget(Id(:pw2), :Value, "") if two_pw dev = Ops.get_symbol(data.value, "type", :unknown) != :loop ? Ops.get_string(data.value, "device", "") : Ops.get_string(data.value, "fpath", "") begin = MiniWorkflow.UserInput if == :next password = Convert.to_string(UI.QueryWidget(Id(:pw1), :Value)) tmp = password tmp = Convert.to_string(UI.QueryWidget(Id(:pw2), :Value)) if two_pw need_verify = !Ops.get_boolean(data.value, "format", false) && !Builtins.isempty(Ops.get_string(data.value, "mount", "")) if !Storage.CheckEncryptionPasswords( password, tmp, min_pw_len, empty_pw_allowed ) || need_verify && !Storage.CheckCryptOk(dev, password, false, false) UI.SetFocus(Id(:pw1)) = :again end end end until == :abort || == :back || == :next if == :next Storage.SetCryptPwd(dev, password) = :finish end Builtins.y2milestone( "MiniWorkflowStepPassword data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepPasswordHelptext(data)
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 677 def MiniWorkflowStepPasswordHelptext(data) data = deep_copy(data) min_pw_len = Ops.get_boolean(data, "format", false) ? 8 : 1 empty_pw_allowed = EmptyCryptPwdAllowed(data) # helptext helptext = _( "<p>\n" + "Keep in mind that this file system is only protected when it is not\n" + "mounted. Once it is mounted, it is as secure as every other\n" + "Linux file system.\n" + "</p>" ) if empty_pw_allowed if Ops.get_symbol(data, "used_fs", :unknown) == :swap # helptext helptext = Ops.add( helptext, _( "<p>\n" + "The file system used for this volume is swap. You can leave the encryption \n" + "password empty, but then the swap device cannot be used for hibernating\n" + "(suspend to disk).\n" + "</p>\n" ) ) else # helptext helptext = Ops.add( helptext, _( "<p>\n" + "This mount point corresponds to a temporary filesystem like /tmp or /var/tmp.\n" + "If you leave the encryption password empty, the system will create\n" + "a random password at system startup for you. This means, you will lose all\n" + "data on these filesystems at system shutdown.\n" + "</p>\n" ) ) end end # helptext helptext = Ops.add( helptext, _( "<p>\n" + "If you forget your password, you will lose access to the data on your file system.\n" + "Choose your password carefully. A combination of letters and numbers\n" + "is recommended. To ensure the password was entered correctly,\n" + "enter it twice.\n" + "</p>\n" ) ) # helptext, %1 is replaced by integer helptext = Ops.add( helptext, Builtins.sformat( _( "<p>\n" + "You must distinguish between uppercase and lowercase. A password should have at\n" + "least %1 characters and, as a rule, not contain any special characters\n" + "(e.g., letters with accents or umlauts).\n" + "</p>\n" ), min_pw_len ) ) # helptext helptext = Ops.add(helptext, _("<p>\nDo not forget this password!\n</p>")) helptext end |
- (Object) MiniWorkflowStepRole(data)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 45 def MiniWorkflowStepRole(data) log.info("MiniWorkflowStepDeviceRole data:#{data.value}") role = data.value.fetch("role", :data) tmp = VBox( term( :LeftRadioButton, Id(:system), # radio button text _("Operating System"), role == :system ), term( :LeftRadioButton, Id(:data), # radio button text _("Data and ISV Applications"), role == :data ), term( :LeftRadioButton, Id(:swap), # radio button text _("Swap"), role == :swap ), term( :LeftRadioButton, Id(:raw), # radio button text _("Raw Volume (unformatted)"), role == :raw ) ) contents = HVSquash( term( :FrameWithMarginBox, # heading for a frame in a dialog _("Role"), RadioButtonGroup(Id(:role), tmp) ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepRoleHelp() ) MiniWorkflow.SetLastStep(false) = nil begin = MiniWorkflow.UserInput() end until == :abort || == :back || == :next if == :next role = UI.QueryWidget(Id(:role), :Value) data.value["role"] = role end log.info("MiniWorkflowStepRole data:#{data.value} ret:#{}") return end |
- (Object) MiniWorkflowStepRoleHelp
37 38 39 40 41 42 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 37 def MiniWorkflowStepRoleHelp() # helptext helptext = _("<p>Choose the role of the device.</p>") helptext end |
- (Object) RescanDisks
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
# File '../../src/include/partitioning/ep-dialogs.rb', line 1295 def RescanDisks UI.OpenDialog( Opt(:decorated), # popup text MarginBox(2, 1, Label(_("Rescanning disks..."))) ) Storage.ReReadTargetMap UI.CloseDialog nil end |