From 9832e62f1476f8b897c00914cfdc933aad57c84b Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 28 Sep 2008 17:33:35 +0000 Subject: [PATCH] Remove Lua backend and add README.DELETED. --- contrib/bsdinstaller-1.1.6/README.DELETED | 107 ++ .../src/backend/lua/200_install.lua | 12 - .../src/backend/lua/400_configure.lua | 12 - .../src/backend/lua/600_upgrade.lua | 10 - .../src/backend/lua/800_netboot.lua | 11 - .../src/backend/lua/Makefile | 23 - .../src/backend/lua/conf/cmdnames.lua | 89 -- .../src/backend/lua/conf/def_pkgs.lua | 12 - .../src/backend/lua/conf/mountpoints.lua | 79 - .../src/backend/lua/conf/sources.lua | 42 - .../lua/configure/100_choose_where_from.lua | 46 - .../backend/lua/configure/200_select_disk.lua | 43 - .../backend/lua/configure/300_select_part.lua | 29 - .../lua/configure/400_mount_target_system.lua | 38 - .../src/backend/lua/configure/500_menu.lua | 12 - .../configure/600_unmount_target_system.lua | 16 - .../src/backend/lua/configure/main.lua | 7 - .../configure/menu/100_set_root_password.lua | 106 -- .../lua/configure/menu/200_add_user.lua | 226 --- .../lua/configure/menu/300_set_timezone.lua | 91 -- .../lua/configure/menu/350_set_datetime.lua | 129 -- .../menu/400_change_console_settings.lua | 158 -- .../configure/menu/500_install_packages.lua | 104 -- .../configure/menu/550_remove_packages.lua | 109 -- .../src/backend/lua/configure/menu/main.lua | 6 - .../src/backend/lua/install/100_welcome.lua | 55 - .../backend/lua/install/200_select_disk.lua | 65 - .../lua/install/250_partition_disk.lua | 316 ---- .../lua/install/270_install_bootblocks.lua | 110 -- .../backend/lua/install/300_select_part.lua | 101 -- .../lua/install/400_select_subparts.lua | 393 ----- .../lua/install/450_select_packages.lua | 45 - .../backend/lua/install/500_install_os.lua | 258 ---- .../lua/install/700_install_bootblocks.lua | 110 -- .../src/backend/lua/install/800_finished.lua | 50 - .../src/backend/lua/install/900_reboot.lua | 33 - .../src/backend/lua/install/main.lua | 13 - .../src/backend/lua/lib/Bitwise.lua | 43 - .../src/backend/lua/lib/Capacity.lua | 1265 ----------------- .../src/backend/lua/lib/CmdChain.lua | 467 ------ .../src/backend/lua/lib/ConfigFile.lua | 105 -- .../src/backend/lua/lib/Disk.lua | 1265 ----------------- .../src/backend/lua/lib/Flow.lua | 149 -- .../src/backend/lua/lib/FlowStep.lua | 149 -- .../src/backend/lua/lib/Installation.lua | 644 --------- .../src/backend/lua/lib/Menu.lua | 178 --- .../src/backend/lua/lib/MenuItem.lua | 178 --- .../src/backend/lua/lib/Network.lua | 391 ----- .../src/backend/lua/lib/Package.lua | 224 --- .../src/backend/lua/lib/PackageGraph.lua | 224 --- .../src/backend/lua/lib/PackageList.lua | 224 --- .../src/backend/lua/lib/PackageSet.lua | 224 --- .../src/backend/lua/lib/Partition.lua | 1265 ----------------- .../src/backend/lua/lib/StorageSystem.lua | 1265 ----------------- .../src/backend/lua/lib/StorageSystemUI.lua | 182 --- .../src/backend/lua/lib/StorageUI.lua | 182 --- .../src/backend/lua/lib/Subpartition.lua | 1265 ----------------- .../src/backend/lua/lib/bitwise.lua | 43 - .../src/backend/lua/lib/cmdchain.lua | 467 ------ .../src/backend/lua/lib/configvars.lua | 105 -- .../src/backend/lua/lib/flow.lua | 149 -- .../src/backend/lua/lib/fsm.lua | 149 -- .../src/backend/lua/lib/menu.lua | 178 --- .../src/backend/lua/lib/mountpoint.lua | 38 - .../src/backend/lua/lib/network.lua | 391 ----- .../src/backend/lua/lib/package.lua | 224 --- .../src/backend/lua/lib/storage.lua | 1265 ----------------- .../src/backend/lua/lib/storage_ui.lua | 182 --- .../src/backend/lua/lib/target_system.lua | 644 --------- .../src/backend/lua/main.lua | 89 -- .../backend/lua/netboot/500_setup_server.lua | 102 -- .../src/backend/lua/netboot/main.lua | 3 - .../backend/lua/pit/100_select_language.lua | 28 - .../backend/lua/pit/800_configure_network.lua | 189 --- .../src/backend/lua/pit/main.lua | 7 - .../src/backend/lua/po/dfuibe_lua.pot | 996 ------------- .../src/backend/lua/po/ru.po | 1221 ---------------- .../src/backend/lua/scripts/test/apptest.lua | 59 - .../src/backend/lua/scripts/test/bitwise.lua | 16 - .../src/backend/lua/scripts/test/clock.lua | 11 - .../src/backend/lua/scripts/test/commands.lua | 45 - .../backend/lua/scripts/test/configvars.lua | 19 - .../src/backend/lua/scripts/test/dfui.lua | 45 - .../src/backend/lua/scripts/test/expander.lua | 26 - .../backend/lua/scripts/test/filesystem.lua | 45 - .../src/backend/lua/scripts/test/fsm.lua | 34 - .../backend/lua/scripts/test/fsm/final.lua | 9 - .../src/backend/lua/scripts/test/fsm/main.lua | 11 - .../backend/lua/scripts/test/fsm/middle.lua | 9 - .../backend/lua/scripts/test/fsm/start.lua | 9 - .../backend/lua/scripts/test/fsm/subfsm.lua | 11 - .../lua/scripts/test/fsm/subfsm/main.lua | 5 - .../lua/scripts/test/fsm/subfsm/one.lua | 9 - .../lua/scripts/test/fsm/subfsm/two.lua | 9 - .../src/backend/lua/scripts/test/main.lua | 113 -- .../src/backend/lua/scripts/test/menu.lua | 79 - .../lua/scripts/test/menu/010_first.lua | 10 - .../lua/scripts/test/menu/020_second.lua | 10 - .../lua/scripts/test/menu/030_third.lua | 10 - .../lua/scripts/test/menu/500_submenu.lua | 12 - .../test/menu/500_submenu/010_first.lua | 10 - .../scripts/test/menu/500_submenu/main.lua | 10 - .../backend/lua/scripts/test/menu/main.lua | 23 - .../src/backend/lua/scripts/test/network.lua | 16 - .../src/backend/lua/scripts/test/pipe.lua | 35 - .../src/backend/lua/scripts/test/progress.lua | 30 - .../src/backend/lua/scripts/test/pty.lua | 74 - .../src/backend/lua/scripts/test/storage.lua | 24 - .../src/backend/lua/scripts/test/wait_for.lua | 20 - .../backend/lua/upgrade/200_select_disk.lua | 40 - .../backend/lua/upgrade/300_select_part.lua | 26 - .../lua/upgrade/400_mount_target_system.lua | 36 - .../lua/upgrade/500_perform_upgrade.lua | 58 - .../lua/upgrade/600_unmount_target_system.lua | 14 - .../src/backend/lua/upgrade/main.lua | 3 - 115 files changed, 107 insertions(+), 20343 deletions(-) create mode 100644 contrib/bsdinstaller-1.1.6/README.DELETED delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/200_install.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/400_configure.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/600_upgrade.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/800_netboot.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/Makefile delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/conf/cmdnames.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/conf/def_pkgs.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/conf/mountpoints.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/conf/sources.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/100_choose_where_from.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/200_select_disk.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/300_select_part.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/400_mount_target_system.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/500_menu.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/600_unmount_target_system.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/100_set_root_password.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/200_add_user.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/300_set_timezone.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/350_set_datetime.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/400_change_console_settings.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/500_install_packages.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/550_remove_packages.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/100_welcome.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/200_select_disk.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/250_partition_disk.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/270_install_bootblocks.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/300_select_part.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/400_select_subparts.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/450_select_packages.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/500_install_os.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/700_install_bootblocks.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/800_finished.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/900_reboot.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/install/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Bitwise.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Capacity.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/CmdChain.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/ConfigFile.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Disk.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Flow.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/FlowStep.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Installation.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Menu.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/MenuItem.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Network.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Package.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageGraph.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageList.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageSet.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Partition.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystem.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystemUI.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageUI.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Subpartition.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/bitwise.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/cmdchain.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/configvars.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/flow.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/fsm.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/menu.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/mountpoint.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/network.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/package.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage_ui.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/lib/target_system.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/500_setup_server.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/pit/100_select_language.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/pit/800_configure_network.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/pit/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/po/dfuibe_lua.pot delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/po/ru.po delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/apptest.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/bitwise.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/clock.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/commands.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/configvars.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/dfui.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/expander.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/filesystem.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/final.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/middle.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/start.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/one.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/two.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/010_first.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/020_second.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/030_third.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/010_first.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/main.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/network.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pipe.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/progress.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pty.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/storage.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/wait_for.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/200_select_disk.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/300_select_part.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/400_mount_target_system.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/500_perform_upgrade.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/600_unmount_target_system.lua delete mode 100644 contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/main.lua diff --git a/contrib/bsdinstaller-1.1.6/README.DELETED b/contrib/bsdinstaller-1.1.6/README.DELETED new file mode 100644 index 0000000000..f5544fc0dc --- /dev/null +++ b/contrib/bsdinstaller-1.1.6/README.DELETED @@ -0,0 +1,107 @@ +src/backend/lua/200_install.lua +src/backend/lua/400_configure.lua +src/backend/lua/600_upgrade.lua +src/backend/lua/800_netboot.lua +src/backend/lua/conf/cmdnames.lua +src/backend/lua/conf/def_pkgs.lua +src/backend/lua/configure/100_choose_where_from.lua +src/backend/lua/configure/200_select_disk.lua +src/backend/lua/configure/300_select_part.lua +src/backend/lua/configure/400_mount_target_system.lua +src/backend/lua/configure/500_menu.lua +src/backend/lua/configure/600_unmount_target_system.lua +src/backend/lua/configure/main.lua +src/backend/lua/configure/menu/100_set_root_password.lua +src/backend/lua/configure/menu/200_add_user.lua +src/backend/lua/configure/menu/300_set_timezone.lua +src/backend/lua/configure/menu/350_set_datetime.lua +src/backend/lua/configure/menu/400_change_console_settings.lua +src/backend/lua/configure/menu/500_install_packages.lua +src/backend/lua/configure/menu/550_remove_packages.lua +src/backend/lua/configure/menu/main.lua +src/backend/lua/conf/mountpoints.lua +src/backend/lua/conf/sources.lua +src/backend/lua/install/100_welcome.lua +src/backend/lua/install/200_select_disk.lua +src/backend/lua/install/250_partition_disk.lua +src/backend/lua/install/270_install_bootblocks.lua +src/backend/lua/install/300_select_part.lua +src/backend/lua/install/400_select_subparts.lua +src/backend/lua/install/450_select_packages.lua +src/backend/lua/install/500_install_os.lua +src/backend/lua/install/700_install_bootblocks.lua +src/backend/lua/install/800_finished.lua +src/backend/lua/install/900_reboot.lua +src/backend/lua/install/main.lua +src/backend/lua/lib/Bitwise.lua +src/backend/lua/lib/Capacity.lua +src/backend/lua/lib/CmdChain.lua +src/backend/lua/lib/ConfigFile.lua +src/backend/lua/lib/configvars.lua +src/backend/lua/lib/Disk.lua +src/backend/lua/lib/Flow.lua +src/backend/lua/lib/FlowStep.lua +src/backend/lua/lib/fsm.lua +src/backend/lua/lib/Installation.lua +src/backend/lua/lib/MenuItem.lua +src/backend/lua/lib/Menu.lua +src/backend/lua/lib/mountpoint.lua +src/backend/lua/lib/Network.lua +src/backend/lua/lib/PackageGraph.lua +src/backend/lua/lib/PackageList.lua +src/backend/lua/lib/Package.lua +src/backend/lua/lib/PackageSet.lua +src/backend/lua/lib/Partition.lua +src/backend/lua/lib/storage.lua +src/backend/lua/lib/StorageSystem.lua +src/backend/lua/lib/StorageSystemUI.lua +src/backend/lua/lib/StorageUI.lua +src/backend/lua/lib/Subpartition.lua +src/backend/lua/lib/target_system.lua +src/backend/lua/main.lua +src/backend/lua/Makefile +src/backend/lua/netboot/500_setup_server.lua +src/backend/lua/netboot/main.lua +src/backend/lua/pit/100_select_language.lua +src/backend/lua/pit/800_configure_network.lua +src/backend/lua/pit/main.lua +src/backend/lua/po/dfuibe_lua.pot +src/backend/lua/po/ru.po +src/backend/lua/scripts/test/apptest.lua +src/backend/lua/scripts/test/bitwise.lua +src/backend/lua/scripts/test/clock.lua +src/backend/lua/scripts/test/commands.lua +src/backend/lua/scripts/test/configvars.lua +src/backend/lua/scripts/test/dfui.lua +src/backend/lua/scripts/test/expander.lua +src/backend/lua/scripts/test/filesystem.lua +src/backend/lua/scripts/test/fsm/final.lua +src/backend/lua/scripts/test/fsm.lua +src/backend/lua/scripts/test/fsm/main.lua +src/backend/lua/scripts/test/fsm/middle.lua +src/backend/lua/scripts/test/fsm/start.lua +src/backend/lua/scripts/test/fsm/subfsm.lua +src/backend/lua/scripts/test/fsm/subfsm/main.lua +src/backend/lua/scripts/test/fsm/subfsm/one.lua +src/backend/lua/scripts/test/fsm/subfsm/two.lua +src/backend/lua/scripts/test/main.lua +src/backend/lua/scripts/test/menu/010_first.lua +src/backend/lua/scripts/test/menu/020_second.lua +src/backend/lua/scripts/test/menu/030_third.lua +src/backend/lua/scripts/test/menu/500_submenu/010_first.lua +src/backend/lua/scripts/test/menu/500_submenu.lua +src/backend/lua/scripts/test/menu/500_submenu/main.lua +src/backend/lua/scripts/test/menu.lua +src/backend/lua/scripts/test/menu/main.lua +src/backend/lua/scripts/test/network.lua +src/backend/lua/scripts/test/pipe.lua +src/backend/lua/scripts/test/progress.lua +src/backend/lua/scripts/test/pty.lua +src/backend/lua/scripts/test/storage.lua +src/backend/lua/scripts/test/wait_for.lua +src/backend/lua/upgrade/200_select_disk.lua +src/backend/lua/upgrade/300_select_part.lua +src/backend/lua/upgrade/400_mount_target_system.lua +src/backend/lua/upgrade/500_perform_upgrade.lua +src/backend/lua/upgrade/600_unmount_target_system.lua +src/backend/lua/upgrade/main.lua diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/200_install.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/200_install.lua deleted file mode 100644 index 578084bc82..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/200_install.lua +++ /dev/null @@ -1,12 +0,0 @@ --- $Id: 200_install.lua,v 1.7 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" - -return { - name = _("Install %s", App.os.name), - short_desc = _("Install %s on this computer system", App.os.name), - effect = function() - App.descend("install") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/400_configure.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/400_configure.lua deleted file mode 100644 index 7e6a463ce3..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/400_configure.lua +++ /dev/null @@ -1,12 +0,0 @@ --- $Id: 400_configure.lua,v 1.4 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" - -return { - name = _("Configure an Installed System"), - short_desc = _("Configure a %s OS that has already been installed", App.os.name), - effect = function() - App.descend("configure") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/600_upgrade.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/600_upgrade.lua deleted file mode 100644 index 4ed9dd5767..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/600_upgrade.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: 600_upgrade.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -return { - name = _("Upgrade an Installed System"), - short_desc = _("Upgrade a system with to the newest available version"), - effect = function() - App.descend("upgrade") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/800_netboot.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/800_netboot.lua deleted file mode 100644 index 6022edf9f6..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/800_netboot.lua +++ /dev/null @@ -1,11 +0,0 @@ --- $Id: 800_netboot.lua,v 1.1 2005/03/27 01:46:09 cpressey Exp $ - -return { - name = _("Set up NetBoot Server"), - short_desc = _("Make this computer a boot server " .. - "for other machines on the network"), - effect = function() - App.descend("netboot") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/Makefile b/contrib/bsdinstaller-1.1.6/src/backend/lua/Makefile deleted file mode 100644 index c04faec92a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# BSD Makefile for dfuibe_lua. -# $Id: Makefile,v 1.42 2005/04/05 20:53:46 cpressey Exp $ - -PACKAGE= dfuibe_lua - -.if defined(WITH_NLS) -LOCALEDIR= /usr/local/share/locale -LANGUAGES= ru -.endif - -all: - @echo "No building required." - -# XXX this will probably be a little nightmarish to do right... -in_cvs: all - -clean: - rm -rf so/*.so po/*.mo - -pot: - cat `find . -name '*.lua' ! -regex '\./scripts/test/main.lua'` | \ - sed 's|\-\-|//|' | sed 's/\.\.//' | \ - xgettext -s -C --no-location --keyword=_ -o po/${PACKAGE}.pot - diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/cmdnames.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/cmdnames.lua deleted file mode 100644 index 55c9a30de4..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/cmdnames.lua +++ /dev/null @@ -1,89 +0,0 @@ --- Example command names conf file for dfuibe_lua backend. --- $Id: cmdnames.lua,v 1.8 2005/03/27 23:15:43 cpressey Exp $ - -local cmd_names = { - SH = "bin/sh", - MKDIR = "bin/mkdir", - CHMOD = "bin/chmod", - LN = "bin/ln", - RM = "bin/rm", - CP = "bin/cp", - DATE = "bin/date", - ECHO = "bin/echo", - DD = "bin/dd", - MV = "bin/mv", - CAT = "bin/cat", - TEST = "bin/test", - TEST_DEV = "bin/test -c", - CPDUP = "bin/cpdup -o -vvv -I", - - ATACONTROL = "sbin/atacontrol", - MOUNT = "sbin/mount", - MOUNT_MFS = "sbin/mount_mfs", - UMOUNT = "sbin/umount", - SWAPON = "sbin/swapon", - DISKLABEL = "sbin/disklabel", - NEWFS = "sbin/newfs", - NEWFS_MSDOS = "sbin/newfs_msdos", - FDISK = "sbin/fdisk", - DUMPON = "sbin/dumpon", - IFCONFIG = "sbin/ifconfig", - ROUTE = "sbin/route", - DHCLIENT = "sbin/dhclient", - SYSCTL = "sbin/sysctl", - - TOUCH = "usr/bin/touch", - YES = "usr/bin/yes", - BUNZIP2 = "usr/bin/bunzip2", - GREP = "usr/bin/grep", - KILLALL = "usr/bin/killall", - BASENAME = "usr/bin/basename", - SORT = "usr/bin/sort", - COMM = "usr/bin/comm", - AWK = "usr/bin/awk", - SED = "usr/bin/sed", - BC = "usr/bin/bc", - TR = "usr/bin/tr", - FIND = "usr/bin/find", - CHFLAGS = "usr/bin/chflags", - XARGS = "usr/bin/xargs", - - PWD_MKDB = "usr/sbin/pwd_mkdb", - CHROOT = "usr/sbin/chroot", - VIDCONTROL = "usr/sbin/vidcontrol", - KBDCONTROL = "usr/sbin/kbdcontrol", - PW = "usr/sbin/pw", - SWAPINFO = "usr/sbin/swapinfo", - BOOT0CFG = "usr/sbin/boot0cfg", - FDFORMAT = "usr/sbin/fdformat", - MTREE = "usr/sbin/mtree", - INETD = "usr/sbin/inetd", - DHCPD = "usr/sbin/dhcpd", - RPCBIND = "usr/sbin/rpcbind", - MOUNTD = "usr/sbin/mountd", - NFSD = "usr/sbin/nfsd", - - PKG_ADD = "usr/sbin/pkg_add", - PKG_DELETE = "usr/sbin/pkg_delete", - PKG_CREATE = "usr/sbin/pkg_create", - PKG_INFO = "usr/sbin/pkg_info", - - TFTPD = "usr/libexec/tftpd", - - CVSUP = "usr/local/bin/cvsup", - MEMTEST = "usr/local/bin/memtest", - - -- These aren't commands, but they're configurable here nonetheless. - - DMESG_BOOT = "var/run/dmesg.boot" -} - -if App.os.name == "OpenBSD" then - cmd_names.TEST_DEV = "bin/test -b" -end - -if App.os.name ~= "DragonFly" then - cmd_names.CPDUP = "usr/local/bin/cpdup -o -vvv" -end - -return cmd_names diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/def_pkgs.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/def_pkgs.lua deleted file mode 100644 index 2b984c610b..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/def_pkgs.lua +++ /dev/null @@ -1,12 +0,0 @@ --- $Id: def_pkgs.lua,v 1.2 2005/02/24 23:08:03 cpressey Exp $ - --- Default packages to install during the install phase. - --- Note that these packages are specified by Lua regular expressions --- that will be passed to string.find(). This allows us to specify --- packages regardless of their version number, etc. - -return { - "^cdrtools-", - "^cvsup-" -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/mountpoints.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/mountpoints.lua deleted file mode 100644 index f872c53d7e..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/mountpoints.lua +++ /dev/null @@ -1,79 +0,0 @@ --- $Id: mountpoints.lua,v 1.4 2005/02/24 23:08:03 cpressey Exp $ - --- Default configuration file for suggested mountpoints. --- --- Note that this file should return a function which takes two --- numbers (the capacity of the partition and the capacity of --- RAM, both in megabytes) and should return a list of tables, --- each like: --- --- { --- mountpoint = "/foo", -- name of mountpoint --- capstring = "123M" -- suggested capacity --- } --- --- Note that the capstring can be "*" to indicate 'use the --- rest of the partition.') - -return function(part_cap, ram_cap) - - -- - -- First, calculate suggested swap size: - -- - local swap = 2 * ram_cap - if ram_cap > (part_cap / 2) or part_cap < 4096 then - swap = ram_cap - end - swap = tostring(swap) .. "M" - - -- - -- Now, based on the capacity of the partition, - -- return an appropriate list of suggested mountpoints. - -- - if part_cap < 523 then - return { - { mountpoint = "/", capstring = "70M" }, - { mountpoint = "swap", capstring = swap }, - { mountpoint = "/var", capstring = "32M" }, - { mountpoint = "/tmp", capstring = "32M" }, - { mountpoint = "/usr", capstring = "174M" }, - { mountpoint = "/home", capstring = "*" } - } - elseif part_cap < 1024 then - return { - { mountpoint = "/", capstring = "96M" }, - { mountpoint = "swap", capstring = swap }, - { mountpoint = "/var", capstring = "64M" }, - { mountpoint = "/tmp", capstring = "64M" }, - { mountpoint = "/usr", capstring = "256M" }, - { mountpoint = "/home", capstring = "*" } - } - elseif part_cap < 4096 then - return { - { mountpoint = "/", capstring = "128M" }, - { mountpoint = "swap", capstring = swap }, - { mountpoint = "/var", capstring = "128M" }, - { mountpoint = "/tmp", capstring = "128M" }, - { mountpoint = "/usr", capstring = "512M" }, - { mountpoint = "/home", capstring = "*" } - } - elseif part_cap < 10240 then - return { - { mountpoint = "/", capstring = "256M" }, - { mountpoint = "swap", capstring = swap }, - { mountpoint = "/var", capstring = "256M" }, - { mountpoint = "/tmp", capstring = "256M" }, - { mountpoint = "/usr", capstring = "3G" }, - { mountpoint = "/home", capstring = "*" } - } - else - return { - { mountpoint = "/", capstring = "256M" }, - { mountpoint = "swap", capstring = swap }, - { mountpoint = "/var", capstring = "256M" }, - { mountpoint = "/tmp", capstring = "256M" }, - { mountpoint = "/usr", capstring = "8G" }, - { mountpoint = "/home", capstring = "*" } - } - end -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/sources.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/sources.lua deleted file mode 100644 index d3e5df91ba..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/conf/sources.lua +++ /dev/null @@ -1,42 +0,0 @@ --- $Id: sources.lua,v 1.3 2005/02/24 23:08:03 cpressey Exp $ - --- Default configuration file for source objects (files and directories) --- to copy to the HDD during the install. - --- Note that this conf file should return list of strings - each string --- is a filename, without any leading root directory specified, which --- will be copied to the HDD during install. - --- Note that if you (for example) do not want to copy /usr/local/share, --- you will need to specify all subdirs of /usr/local except for share --- in this list. - -return { - "COPYRIGHT", - "bin", - "boot", - "cdrom", - "dev", - "etc", - "libexec", - "lib", - "kernel", - "modules", - "root", - "sbin", - "sys", - "tmp", - "usr/bin", - "usr/games", - "usr/include", - "usr/lib", --- "usr/local", -- we should use mtree to generate the hier for --- "usr/X11R6", -- these, then use pkg_add to populate them. - "usr/libdata", - "usr/libexec", - "usr/obj", - "usr/sbin", - "usr/share", - "usr/src", - "var" -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/100_choose_where_from.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/100_choose_where_from.lua deleted file mode 100644 index 64fbf8d782..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/100_choose_where_from.lua +++ /dev/null @@ -1,46 +0,0 @@ --- $Id: 100_choose_where_from.lua,v 1.3 2005/02/24 23:08:03 cpressey Exp $ - -require "target_system" - -return { - name = "choose_target_system", - title = "Choose Target System", - action = function(fsm) - local action_id = App.ui:present({ - id = "choose_target_system", - name = _("Choose Target System"), - short_desc = _( - "Please choose which installed system you want to configure." - ), - actions = { - { - id = "this", - name = _("Configure the Running System") - }, - { - id = "disk", - name = _("Configure a System on Disk") - }, - { - id = "cancel", - name = _("Cancel"), - } - }, - role = "menu" - }).action_id - - if action_id == "cancel" then - return nil - end - - if action_id == "disk" then - return fsm:next() - end - - App.state.target = TargetSystem.new() - App.state.target:use_current() - - -- Jump straight to the menu. - return "configuration_menu" - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/200_select_disk.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/200_select_disk.lua deleted file mode 100644 index 35953b3bb3..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/200_select_disk.lua +++ /dev/null @@ -1,43 +0,0 @@ --- $Id: 200_select_disk.lua,v 1.5 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" -require "storage_ui" - -return { - name = "select_disk", - title = "Select Disk", - action = function(fsm) - App.state.sel_disk = nil - App.state.sel_part = nil - - -- XXX there might be a better place to handle this. - if App.state.storage:get_disk_count() == 0 then - App.ui:inform(_( - "The installer could not find any suitable disks " .. - "attached to this computer. If you wish to " .. - "configure an installation of %s " .. - "on an unorthodox storage device, you will have to " .. - "exit to a LiveCD command prompt and configure it " .. - "manually, using the file /README as a guide.", - App.os.name) - ) - return nil - end - - local dd = StorageUI.select_disk({ - sd = App.state.storage, - short_desc = _( - "Select the disk on which the installation of %s " .. - "that you wish to configure resides.", - App.os.name), - cancel_desc = _("Return to Main") -- _("Return to %s", fsm:prev().title) - }) - - if dd then - App.state.sel_disk = dd - return fsm:next() - else - return nil -- fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/300_select_part.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/300_select_part.lua deleted file mode 100644 index 9729d6af8b..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/300_select_part.lua +++ /dev/null @@ -1,29 +0,0 @@ --- $Id: 300_select_part.lua,v 1.4 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" -require "storage_ui" - -return { - name = "select_part", - title = "Select Partition", - action = function(fsm) - App.state.sel_part = nil - - local pd = StorageUI.select_part({ - dd = App.state.sel_disk, - short_desc = _( - "Select the primary partition of %s " .. - "on which the installation of %s resides.", - App.state.sel_disk:get_name(), - App.os.name), - cancel_desc = _("Return to %s", fsm:prev().title) - }) - - if pd then - App.state.sel_part = pd - return fsm:next() - else - return fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/400_mount_target_system.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/400_mount_target_system.lua deleted file mode 100644 index e9889c4c13..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/400_mount_target_system.lua +++ /dev/null @@ -1,38 +0,0 @@ --- $Id: 400_mount_target_system.lua,v 1.13 2005/02/24 23:08:03 cpressey Exp $ - -require "target_system" - -return { - name = "mount_target_system", - title = "Mount Target System", - action = function(fsm) - -- - -- If there is a target system mounted, unmount it before starting. - -- - if App.state.target ~= nil and App.state.target:is_mounted() then - if not App.state.target:unmount() then - App.ui:inform( - _("Warning: already-mounted target system could " .. - "not be correctly unmounted first.") - ) - return fsm:prev() - end - end - - App.state.target = TargetSystem.new(App.state.sel_part, "mnt") - if not App.state.target:probe() then - App.ui:inform(_( - "The target system could not be successfully probed." - )) - return fsm:prev() - end - if not App.state.target:mount() then - App.ui:inform(_( - "The target system could not be successfully mounted." - )) - return fsm:prev() - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/500_menu.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/500_menu.lua deleted file mode 100644 index bcc361e947..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/500_menu.lua +++ /dev/null @@ -1,12 +0,0 @@ --- $Id: 500_menu.lua,v 1.4 2005/02/24 23:08:03 cpressey Exp $ - -require "dfui" - -return { - name = "configuration_menu", - title = "Configuration Menu", - action = function(fsm) - App.descend("menu") - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/600_unmount_target_system.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/600_unmount_target_system.lua deleted file mode 100644 index cc73fb821c..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/600_unmount_target_system.lua +++ /dev/null @@ -1,16 +0,0 @@ --- $Id: 600_unmount_target_system.lua,v 1.4 2005/02/24 23:08:03 cpressey Exp $ - -require "target_system" - -return { - name = "unmount_target_system", - title = "Unmount Target System", - action = function(fsm) - if App.state.target:unmount() then - return fsm:next() - else - App.ui:inform("Target system could not be unmounted!") - return nil - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/main.lua deleted file mode 100644 index 9932acbf6c..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/main.lua +++ /dev/null @@ -1,7 +0,0 @@ --- demo/configure/main.lua --- $Id: main.lua,v 1.6 2005/02/24 23:08:03 cpressey Exp $ --- Main segment of the demonstration configurator. - -require "fsm" - -FSM.auto("choose_target_system") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/100_set_root_password.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/100_set_root_password.lua deleted file mode 100644 index 9d2e3597b7..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/100_set_root_password.lua +++ /dev/null @@ -1,106 +0,0 @@ --- $Id: 100_set_root_password.lua,v 1.6 2005/03/29 18:00:18 den Exp $ - -require "gettext" - -local set_root_password = function() - local done = false - local result - local cmds - local form = { - id = "root_passwd", - name = _("Set Root Password"), - short_desc = _( - "Here you can set the super-user (root) password." - ), - - fields = { - { - id = "root_passwd_1", - name = _("Root Password"), - short_desc = _("Enter the root password you would like to use"), - obscured = "true" - }, - { - id = "root_passwd_2", - name = _("Re-type Root Password"), - short_desc = _("Enter the same password again to confirm"), - obscured = "true" - } - }, - - actions = { - { - id = "ok", - name = _("Accept and Set Password") - }, - { - id = "cancel", - name = _("Return to Configure Menu") - } - }, - - datasets = { - { root_passwd_1 = "", root_passwd_2 = "" } - } - } - - while not done do - result = App.ui:present(form) - - if result.action_id == "ok" then - form.datasets = result.datasets - - -- - -- Fetch form field values. - -- - - local root_passwd_1 = result.datasets[1].root_passwd_1 - local root_passwd_2 = result.datasets[1].root_passwd_2 - - --[[ - if (!assert_clean(a->c, _("Root Password"), root_passwd_1, PW_NOT_ALLOWED)) { - done = 0; - ]]-- - - if root_passwd_1 == root_passwd_2 then - -- - -- Passwords match, so set the root password. - -- - cmds = CmdChain.new() - App.state.target:cmds_set_password(cmds, - "root", root_passwd_1) - if cmds:execute() then - App.ui:inform( - _("The root password has been changed.") - ) - done = true - else - App.ui:inform( - _("An error occurred when " .. - "setting the root password.") - ) - done = false - end - else - -- - -- Passwords don't match - tell the user, let them try again. - -- - App.ui:inform( - _("The passwords do not match.") - ) - done = false - end - else - -- Cancelled - done = true - end - end -end - -return { - name = _("Set Root Password"), - effect = function() - set_root_password() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/200_add_user.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/200_add_user.lua deleted file mode 100644 index fb01cf583a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/200_add_user.lua +++ /dev/null @@ -1,226 +0,0 @@ --- $Id: 200_add_user.lua,v 1.7 2005/03/29 12:12:15 den Exp $ - -require "gettext" - -local is_gecos_clean = function(gecos) - local i, char - - i = 1 - while i <= string.len(gecos) do - char = string.sub(gecos, i, i) - if string.find(char, "%c") or -- no ctrl chars - string.byte(char) == 127 or -- no 'DEL' char - string.find(":!@", char, 1, true) then -- none of these - return false - end - i = i + 1 - end - - return true -end - -local is_name_clean = function(name) - local i, char - - i = 1 - while i <= string.len(name) do - char = string.sub(name, i, i) - if string.find(char, "%c") or -- no ctrl chars - string.byte(char) == 127 or -- no 'DEL' char - string.byte(char) > 127 or -- no 8-bit chars - -- and none of these: - string.find(" ,\t:+&#%^()!@~*?<>=|\\/\"", char, 1, true) or - (char == "-" and i == 1) or -- no '-' at start - -- '$' only at end: - (char == "$" and i ~= string.len(name)) then - return false - end - i = i + 1 - end - - return true -end - -local add_user = function() - local done = false - local result - local cmds - - local form = { - id = "add_user", - name = _("Add User"), - short_desc = _("Here you can add a user to an installed system.\n\n" .. - "You can leave the Home Directory, User ID, and Login Group " .. - "fields empty if you want these items to be automatically " .. - "allocated by the system."), - fields = { - { - id = "username", - name = _("Username"), - short_desc = _("Enter the username the user will log in as") - }, - { - id = "gecos", - name = _("Real Name"), - short_desc = _("Enter the real name (or GECOS field) of this user") - }, - { - id = "passwd_1", - name = _("Password"), - short_desc = _("Enter the user's password (will not be displayed)"), - obscured = "true" - }, - { - id = "passwd_2", - name = _("Password (Again)"), - short_desc = _("Re-enter the user's password to confirm"), - obscured = "true" - }, - { - id = "shell", - name = _("Shell"), - short_desc = _("Enter the full path to the user's shell program") - }, - { - id = "home", - name = _("Home Directory"), - short_desc = _("Enter the full path to the user's home directory, or leave blank") - }, - { - id = "uid", - name = _("User ID"), - short_desc = _("Enter this account's numeric user id, or leave blank") - }, - { - id = "group", - name = _("Login Group"), - short_desc = _("Enter the primary group for this account, or leave blank") - }, - { - id = "groups", - name = _("Other Group Memberships"), - short_desc = _( - "Enter a comma-separated list of other groups " .. - "that this user should belong to" - ) - } - }, - actions = { - { - id = "ok", - name = _("Accept and Add User") - }, - { - id = "cancel", - name = _("Return to Configure Menu") - } - }, - datasets = { - { - username = "", - gecos = "", - passwd_1 = "", - passwd_2 = "", - shell = "/bin/tcsh", - home = "", - uid = "", - group = "", - groups = "" - } - } - } - - while not done do - result = App.ui:present(form) - if result.action_id == "ok" then - form.datasets = result.datasets - - -- - -- Fetch form field values. - -- - local username = result.datasets[1].username - local gecos = result.datasets[1].gecos - local passwd_1 = result.datasets[1].passwd_1 - local passwd_2 = result.datasets[1].passwd_2 - local shell = result.datasets[1].shell - local home = result.datasets[1].home - local uid = result.datasets[1].uid - local group = result.datasets[1].group - local groups = result.datasets[1].groups - - -- - -- Valid field values. - -- - - if string.len(username) == 0 then - App.ui:inform(_( - "You must enter a username." - )) - elseif passwd_1 ~= passwd_2 then - App.ui:inform(_( - "The passwords do not match." - )) - elseif not is_name_clean(username) then - App.ui:inform(_( - "The username contains illegal characters." - )) - elseif not is_gecos_clean(gecos) then - App.ui:inform(_( - "The text specified in the Real Name " .. - "field contains illegal characters." - )) - elseif not is_name_clean(group) then - App.ui:inform(_( - "The name of the login group contains " .. - "illegal characters." - )) - --[[ - !assert_clean(a->c, _("Home Directory"), home, FILENAME_NOT_ALLOWED) || - !assert_clean(a->c, _("User ID"), uid, PW_NOT_ALLOWED) || - !assert_clean(a->c, _("Group Memberships"), groups, MEMBERSHIPS_NOT_ALLOWED)) { - done = 0; - ]]-- - elseif not FileSystem.is_program(App.dir.root .. shell) and - shell ~= "/nonexistent" then - App.ui:inform(_( - "The selected shell does not exist on the system." - )) - else - local cmds = CmdChain.new() - - App.state.target:cmds_add_user(cmds, { - username = username, - gecos = gecos, - shell = shell, - uid = uid, - group = group, - home = home, - groups = groups, - password = passwd_1 - }) - if cmds:execute() then - App.ui:inform(_( - "User `%s' was added.", - username - )) - done = true - else - App.ui:inform(_( - "User was not successfully added." - )) - end - end - else - -- Cancelled. - done = true - end - end -end - -return { - name = _("Add User"), - effect = function() - add_user() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/300_set_timezone.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/300_set_timezone.lua deleted file mode 100644 index 064148a645..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/300_set_timezone.lua +++ /dev/null @@ -1,91 +0,0 @@ --- $Id: 300_set_timezone.lua,v 1.3 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" - -local set_timezone = function() - local cmds, files, dir, filename, full_filename, found_file - - if App.ui:present({ - id = "internal_clock_type", - name = _("Local or UTC (Greenwich Mean Time) clock"), - short_desc = _( - "Is this machine's internal clock set to local time " .. - "or UTC (Universal Coordinated Time, roughly the same " .. - "as Greenwich Mean Time)?\n\n" .. - "If you don't know, assume local time for now." - ), - - actions = { - { - id = "local", - name = _("Local Time") - }, - { - id = "utc", - name = _("UTC Time") - } - } - }).action_id == "utc" then - cmds = CmdChain.new() - - cmds:add({ - cmdline = "${root}${TOUCH} ${root}${base}etc/wall_cmos_clock", - replacements = { - base = App.state.target:get_base() - } - }) - cmds:execute() - end - - -- - -- Select a file. - -- - dir = App.expand("${root}${base}usr/share/zoneinfo", - { - base = App.state.target:get_base() - } - ) - - found_file = false - while not found_file do - filename = App.ui:select_file{ - title = _("Select Time Zone"), - short_desc = _("Select a Time Zone appropriate to your physical location."), - cancel_desc = _("Return to Utilities Menu"), - dir = dir - } - if filename == "cancel" then - return false - end - full_filename = dir .. "/" .. filename - if FileSystem.is_dir(full_filename) then - dir = full_filename - else - filename = full_filename - found_file = true - end - end - - cmds = CmdChain.new() - cmds:add({ - cmdline = "${root}${CP} ${filename} ${root}${base}etc/localtime", - replacements = { - filename = filename, - base = App.state.target:get_base() - } - }) - if cmds:execute() then - App.ui:inform(_( - "The Time Zone has been successfully set to %s.", - filename - )) - end -end - -return { - name = _("Set Timezone"), - effect = function() - set_timezone() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/350_set_datetime.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/350_set_datetime.lua deleted file mode 100644 index bd101af8d1..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/350_set_datetime.lua +++ /dev/null @@ -1,129 +0,0 @@ --- $Id: 350_set_datetime.lua,v 1.2 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" - -local set_datetime = function() - local cmds, date_tab, form, response - - date_tab = os.date("*t") - - form = { - id = "set_datetime", - name = _("Set Time and Date"), - short_desc = _( - "Enter the current date and time of day to set " .. - "this computer's internal timekeeping clock." - ), - - fields = { - { - id = "year", - name = _("Year"), - short_desc = _("Enter the current year (e.g. `2004')") - }, - { - id = "month", - name = _("Month"), - short_desc = _("Enter the current month (e.g. `07')") - }, - { - id = "day", - name = _("Day"), - short_desc = _("Enter the current day of month (e.g. `30')") - }, - { - id = "hour", - name = _("Hour"), - short_desc = _("Enter the current hour (e.g. `07')") - }, - { - id = "min", - name = _("Minute"), - short_desc = _("Enter the current minute (e.g. `59')") - } - }, - - datasets = { - { - year = tostring(date_tab.year), - month = tostring(date_tab.month), - day = tostring(date_tab.day), - hour = tostring(date_tab.hour), - min = tostring(date_tab.min) - } - }, - - actions = { - { - id = "ok", - name = _("OK") - }, - { - id = "cancel", - name = _("Cancel") - } - } - } - - while not done do - response = App.ui:present(form) - if response.action_id ~= "ok" then - return false - end - - date_tab = { - year = tonumber(response.datasets[1].year), - month = tonumber(response.datasets[1].month), - day = tonumber(response.datasets[1].day), - hour = tonumber(response.datasets[1].hour), - min = tonumber(response.datasets[1].min) - } - - -- - -- Validate the given date and time. - -- - - if date_tab.year > 0 and - date_tab.month >= 1 and date_tab.month <= 12 and - date_tab.day >= 1 and date_tab.day <= 31 and - date_tab.hour >= 0 and date_tab.hour <= 23 and - date_tab.min >= 0 and date_tab.min <= 59 then - - cmds = CmdChain.new() - cmds:add("${root}${DATE} -n " .. string.format( - "%04d%02d%02d%02d%02d", - date_tab.year, - date_tab.month, - date_tab.day, - date_tab.hour, - date_tab.min - )) - if cmds:execute() then - App.ui:inform(_( - "The time and date have successfully been set." - )) - done = true - else - App.ui:inform(_( - "An error occurred while attempting to set " .. - "time and date." - )) - end - else - App.ui:inform(_( - "Please enter numbers within acceptable ranges " .. - "for year, month, day of month, hour, and minute." - )) - end - end - - return true -end - -return { - name = _("Set Time and Date"), - effect = function() - set_datetime() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/400_change_console_settings.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/400_change_console_settings.lua deleted file mode 100644 index 46d7e39129..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/400_change_console_settings.lua +++ /dev/null @@ -1,158 +0,0 @@ --- $Id: 400_change_console_settings.lua,v 1.2 2005/02/24 23:08:03 cpressey Exp $ - -require "gettext" - -local set_keyboard_map = function() - local cmds, files, dir, filename, full_filename - - -- - -- Select a file. - -- - dir = App.expand("${root}${base}usr/share/syscons/keymaps", - { - base = App.state.target:get_base() - } - ) - - filename = App.ui:select_file{ - title = _("Select Keyboard Map"), - short_desc = _( - "Select a keyboard map appropriate to your keyboard layout." - ), - cancel_desc = _("Return to Utilities Menu"), - dir = dir, - extension = "kbd" - } - if filename == "cancel" then - return false - end - filename = dir .. "/" .. filename - - cmds = CmdChain.new() - cmds:add{ - cmdline = "${root}${KBDCONTROL} -l ${filename} < /dev/ttyv0", - replacements = { filename = filename } - } - if cmds:execute() then - --[[ - snprintf(filename, 256, "/usr/share/syscons/keymaps/%s", s); - snprintf(keymapname, 256, filename_noext(basename(filename))); - config_var_set(rc_conf, "keymap", keymapname); - ]]-- - - return true - else - App.ui:inform(_( - "Errors occurred; keyboard map was not successfully set." - )) - end -end - -local set_video_font = function() - local cmds, files, dir, filename, full_filename - - -- - -- Select a file. - -- - dir = App.expand("${root}${base}usr/share/syscons/fonts", - { - base = App.state.target:get_base() - } - ) - - filename = App.ui:select_file{ - title = _("Select Console Font"), - short_desc = _("Select a font appropriate to your video monitor and language."), - cancel_desc = _("Return to Utilities Menu"), - dir = dir, - extension = "fnt" - } - if filename == "cancel" then - return false - end - filename = dir .. "/" .. filename - - cmds = CmdChain.new() - cmds:add{ - cmdline = "${root}${VIDCONTROL} -f ${filename} < /dev/ttyv0", - replacements = { filename = filename } - } - if cmds:execute() then - local found, len, w, h = string.find(filename, "(%d+)x(%d+)") - if found then - w = tonumber(w) - h = tonumber(h) - --[[ - snprintf(variable, 256, "font8x%d", by); - snprintf(filename, 256, "/usr/share/syscons/fonts/%s", s); - snprintf(fontname, 256, filename_noext(basename(filename))); - config_var_set(rc_conf, variable, fontname); - ]]-- - end - - return true - else - App.ui:inform(_( - "Errors occurred; video font was not successfully set." - )) - end -end - - -local set_screen_map = function() - local cmds, files, dir, filename, full_filename - - -- - -- Select a file. - -- - dir = App.expand("${root}${base}usr/share/syscons/scrnmaps", - { - base = App.state.target:get_base() - } - ) - - filename = App.ui:select_file{ - title = _("Select Screen Map"), - short_desc = _( - "Select a mapping for translating characters as they " .. - "appear on your video console screen." - ), - cancel_desc = _("Return to Utilities Menu"), - dir = dir, - extension = "scm" - } - if filename == "cancel" then - return false - end - filename = dir .. "/" .. filename - - cmds = CmdChain.new() - cmds:add{ - cmdline = "${root}${VIDCONTROL} -l ${filename} < /dev/ttyv0", - replacements = { filename = filename } - } - if cmds:execute() then - --[[ - snprintf(filename, 256, "/usr/share/syscons/scrnmaps/%s", s); - snprintf(scrnmapname, 256, filename_noext(basename(filename))); - config_var_set(rc_conf, "scrnmap", scrnmapname); - ]]-- - - return true - else - App.ui:inform(_( - "Errors occurred; screen map was not successfully set." - )) - end -end - -return { - name = _("Change Console Settings"), - effect = function() - if set_video_font() and set_screen_map() and set_keyboard_map() then - -- everything was set. - -- XXX write to rc.conf ? - end - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/500_install_packages.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/500_install_packages.lua deleted file mode 100644 index 1766e43893..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/500_install_packages.lua +++ /dev/null @@ -1,104 +0,0 @@ --- $Id: 500_install_packages.lua,v 1.7 2005/04/04 20:38:50 cpressey Exp $ - -require "cmdchain" -require "package" -require "storage_ui" - -local num_keys = function(tab) - local k, v - local i = 0 - for k, v in tab do i = i + 1 end - return i -end - -local install_packages = function() - local base = App.state.target:get_base() - local pkg_list = Package.list_all("") - local ok, i, pkg_name, selected - local sel_pkgs = {} - - for i, pkg_name in pkg_list do - if not Package.exists(base, pkg_name) then - sel_pkgs[pkg_name] = false -- but present... - end - end - - ok, sel_pkgs = StorageUI.select_packages{ - name = _("Select Packages"), - short_desc = _("Select the packages you wish to install from " .. - "the LiveCD onto the HDD."), - checkbox_name = _("Install?"), - ok_name = _("Install these Packages"), - cancel_name = _("Cancel"), - - sel_pkgs = sel_pkgs - } - - if ok then - local cmds = CmdChain.new() - local pkg_seen = {} - local pkg_done = {} - local pkg_extra = "" - local n, i = 0, 0 - local pr = App.ui:new_progress_bar{ - title = _("Calculating package dependencies...") - } - - for pkg_name, selected in sel_pkgs do - if selected then - n = n + 1 - end - end - - pr:start() - for pkg_name, selected in sel_pkgs do - if selected then - Package.cmds_copy( - base, cmds, pkg_name, pkg_seen, pkg_done - ) - i = i + 1 - pr:set_amount((i * 100) / n) - pr:update() - end - end - pr:stop() - - for pkg_name, selected in pkg_seen do - if not sel_pkgs[pkg_name] then - pkg_extra = pkg_extra .. pkg_name .. "\n" - end - end - - if pkg_extra ~= "" then - if not App.ui:confirm(_( - "The following packages are required to " .. - "support the packages you selected, and " .. - "will also be installed:\n\n%s\n" .. - "Is this acceptable?", pkg_extra - )) then - return - end - end - - if cmds:execute() then - App.ui:inform(_( - "%d/%d packages were successfully installed!", - num_keys(pkg_done), num_keys(pkg_seen) - )) - else - App.ui:inform(_( - "Errors occurred while installing packages. " .. - "Some packages may not have been " .. - "successfully installed." - )) - end - end -end - -return { - name = _("Install Packages"), - effect = function() - install_packages() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/550_remove_packages.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/550_remove_packages.lua deleted file mode 100644 index eee5c20216..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/550_remove_packages.lua +++ /dev/null @@ -1,109 +0,0 @@ --- $Id: 550_remove_packages.lua,v 1.7 2005/04/04 20:38:50 cpressey Exp $ - -require "cmdchain" -require "package" -require "storage_ui" - -local num_keys = function(tab) - local k, v - local i = 0 - for k, v in tab do i = i + 1 end - return i -end - -local remove_packages = function() - local base = App.state.target:get_base() - local pkg_list = Package.list_all(base) - local ok, i, pkg_name, selected - local sel_pkgs = {} - - if table.getn(pkg_list) == 0 then - App.ui:inform(_( - "There are no packages installed on this system." - )) - return - end - - for i, pkg_name in pkg_list do - sel_pkgs[pkg_name] = false -- but present... - end - - ok, sel_pkgs = StorageUI.select_packages{ - name = _("Select Packages"), - short_desc = _("Select the packages you wish to remove from " .. - "this system"), - checkbox_name = _("Remove?"), - ok_name = _("Remove these Packages"), - cancel_name = _("Cancel"), - - sel_pkgs = sel_pkgs - } - - if ok then - local cmds = CmdChain.new() - local pkg_seen = {} - local pkg_done = {} - local pkg_extra = "" - local n, i = 0, 0 - local pr = App.ui:new_progress_bar{ - title = _("Calculating package dependencies...") - } - - for pkg_name, selected in sel_pkgs do - if selected then - n = n + 1 - end - end - - pr:start() - for pkg_name, selected in sel_pkgs do - if selected then - Package.cmds_remove( - base, cmds, pkg_name, pkg_seen, pkg_done - ) - i = i + 1 - pr:set_amount((i * 100) / n) - pr:update() - end - end - pr:stop() - - for pkg_name, selected in pkg_seen do - if not sel_pkgs[pkg_name] then - pkg_extra = pkg_extra .. pkg_name .. "\n" - end - end - - if pkg_extra ~= "" then - if not App.ui:confirm(_( - "The following installed packages require " .. - "one or more of the packages you selected, " .. - "and will also be removed:\n\n%s\n" .. - "Is this acceptable?", pkg_extra - )) then - return - end - end - - if cmds:execute() then - App.ui:inform(_( - "%d/%d packages were successfully removed!", - num_keys(pkg_done), num_keys(pkg_seen) - )) - else - App.ui:inform(_( - "There were errors. " .. - "Some packages may not have been " .. - "successfully removed." - )) - end - end -end - -return { - name = _("Remove Packages"), - effect = function() - remove_packages() - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/main.lua deleted file mode 100644 index 94cfe33780..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/configure/menu/main.lua +++ /dev/null @@ -1,6 +0,0 @@ --- $Id: main.lua,v 1.3 2005/02/24 23:08:04 cpressey Exp $ - -Menu.auto{ - name = _("Select Component to Configure"), - short_desc = _("Choose one of the following things to configure.") -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/100_welcome.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/100_welcome.lua deleted file mode 100644 index af8abbcc1c..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/100_welcome.lua +++ /dev/null @@ -1,55 +0,0 @@ --- $Id: 100_welcome.lua,v 1.7 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "welcome", - title = "Welcome", - action = function(fsm) - return App.ui:present({ - id = "begin_install", - name = _("Begin Installation"), - short_desc = _( - "This experimental application will install %s" .. - " on one of the hard disk drives attached to this computer. " .. - "It has been designed to make it easy to install " .. - "%s in the typical case. " .. - "If you have special requirements that are not addressed " .. - "by this installer, or if you have problems using it, you " .. - "are welcome to install %s manually. " .. - "To do so select Exit to Live CD, login as root, and follow " .. - "the instructions given in the file /README ." .. - "\n\n" .. - "NOTE! As with any installation process, YOU ARE " .. - "STRONGLY ENCOURAGED TO BACK UP ANY IMPORTANT DATA ON THIS " .. - "COMPUTER BEFORE PROCEEDING!", - App.os.name, App.os.name, App.os.name), - long_desc = _( - "Some situations in which you might not wish to use this " .. - "installer are:\n\n" .. - "- you want to install %s onto a " .. - "logical/extended partition;\n" .. - "- you want to install %s " .. - "onto a ``dangerously dedicated'' disk; or\n" .. - "- you want full and utter control over the install process.", - App.os.name, App.os.name), - - actions = { - { - id = "proceed", - name = _("Install %s", App.os.name), - effect = function() - return fsm:next() - end - }, - { - id = "cancel", - name = _("Return to Previous Menu"), - effect = function() - return nil - end - } - } - }).result - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/200_select_disk.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/200_select_disk.lua deleted file mode 100644 index 3f218c75c6..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/200_select_disk.lua +++ /dev/null @@ -1,65 +0,0 @@ --- $Id: 200_select_disk.lua,v 1.16 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" -require "storage_ui" - -return { - name = "select_disk", - title = "Select Disk", - action = function(fsm) - App.state.sel_disk = nil - App.state.sel_part = nil - - -- XXX there might be a better place to handle this. - if App.state.storage:get_disk_count() == 0 then - App.ui:inform(_( - "The installer could not find any disks suitable " .. - "for installation (IDE or SCSI) attached to this " .. - "computer. If you wish to install %s" .. - " on an unorthodox storage device, you will have to " .. - "exit to a LiveCD command prompt and install it " .. - "manually, using the file /README as a guide.", - App.os.name) - ) - return nil - end - - local dd = StorageUI.select_disk({ - sd = App.state.storage, - short_desc = _("Select a disk on which to install %s.", - App.os.name), - cancel_desc = _("Return to %s", fsm:prev().title) - }) - - if dd then - if dd:is_mounted() then - App.ui:inform( - _("One or more subpartitions of one or more " .. - "primary partitions of the selected disk " .. - "are already in use (they are currently " .. - "mounted on mountpoints in the filesystem.) " .. - "You should either unmount them before " .. - "proceeding, or select a different disk to " .. - "install %s on.", App.os.name)) - return fsm:current() - end - - App.state.sel_disk = dd - - -- XXX there might be a better place to handle this. - if dd:get_capacity() < App.state.disk_min then - App.ui:inform(_( - "WARNING: you should have a disk " .. - "at least %dM in size, or " .. - "you may encounter problems trying to " .. - "install %s.", - App.state.disk_min, App.os.name) - ) - end - - return fsm:next() - else - return fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/250_partition_disk.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/250_partition_disk.lua deleted file mode 100644 index 8dca664027..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/250_partition_disk.lua +++ /dev/null @@ -1,316 +0,0 @@ --- $Id: 250_partition_disk.lua,v 1.21 2005/03/31 12:35:50 den Exp $ - -require "gettext" - -local datasets_list = nil - -local name_to_sysid_map = { - ["DragonFly/FreeBSD"] = 165, - ["OpenBSD"] = 166, - ["NetBSD"] = 169, - ["MS-DOS"] = 15, - ["Linux"] = 131, - ["Plan9"] = 57 -} - -local options_list = {} -local sysid_to_name_map = {} -local k, v -for k, v in name_to_sysid_map do - table.insert(options_list, k) - sysid_to_name_map[v] = k -end - -local populate_from_disk = function(dd) - local pd - local list = {} - - local toyn = function(bool) - if bool then - return "Y" - else - return "N" - end - end - - for pd in dd:get_parts() do - table.insert(list, { - capstring = StorageDescriptor.format_capstring(pd:get_size()), - sysid = sysid_to_name_map[pd:get_sysid()] or - tostring(pd:get_sysid()), - active = toyn(pd:is_active()) - }) - end - - return list -end - -local populate_one_big_partition = function(dd) - return { - { - capstring = "*", - sysid = "165", - active = "Y" - } - } -end - -local edit_partitions = function(fsm) - if not datasets_list then - datasets_list = populate_from_disk(App.state.sel_disk) - end - - local fields_list = { - { - id = "capstring", - name = _("Capacity") - }, - { - id = "sysid", - name = _("Partition Type"), - options = options_list, - editable = "false" - }, - { - id = "active", - name = _("Active?"), - control = "checkbox" - } - } - - local actions_list = { - { - id = "ok", - name = _("Accept and Create"), - }, - { - id = "cancel", - name = _("Return to %s", fsm:prev().title), - } - } - - local response = App.ui:present({ - id = "edit_partitions", - name = _("Edit Partitions"), - short_desc = _("Select the partitions (also known " .. - "as `slices' in BSD tradition) you want to " .. - "have on this disk.\n\n" .. - "For Capacity, use 'M' to indicate megabytes, 'G' to " .. - "indicate gigabytes, or a single '*' to indicate " .. - "'use the remaining space on the disk'."), - special = "bsdinstaller_edit_partitions", - minimum_width = "64", - - actions = actions_list, - fields = fields_list, - datasets = datasets_list, - - multiple = "true", - extensible = "true" - }) - - -- remember these subpartition selections in case we come back here. - datasets_list = response.datasets - - return response.action_id == "ok" -end - -local check_datasets = function(dd, list) - local i, dataset - local size - local disk_size = dd:get_raw_size() - local used_size = 60 -- initial offset - local wildcard_size = false - - for i, dataset in list do - if (name_to_sysid_map[dataset.sysid] or tonumber(dataset.sysid)) == 0 then - App.ui:inform(_( - "'%s' is not a recognized partition type. " .. - "Please use a numeric identifier if you " .. - "wish to use an unlisted partition type.", - dataset.sysid - )) - return false - end - - if dataset.capstring == "*" then - if wildcard_size then - App.ui:inform(_( - "Only one partition may have a " .. - "capacity of '*'." - )) - return false - end - wildcard_size = true - end - - size = StorageDescriptor.parse_capstring(dataset.capstring, 0) - if not size then - App.ui:inform(_( - "Capacity must either end in 'M' " .. - "for megabytes, 'G' for gigabytes, " .. - "or be '*' to indicate 'use all " .. - "remaining space.'" - )) - return false - end - - used_size = used_size + size - end - - if used_size > disk_size then - if not App.ui:confirm(_( - "WARNING: The total number of sectors needed " .. - "for the requested partitions (%d) exceeds the " .. - "number of sectors available on the disk (%d) " .. - "by %d sectors (%s.)\n\n" .. - "This is an invalid configuration; we " .. - "recommend shrinking the size of one or " .. - "more partitions before proceeding.\n\n" .. - "Proceed anyway?", - used_size, disk_size, used_size - disk_size, - StorageDescriptor.format_capstring(used_size - disk_size))) then - return false - end - end - - if used_size < disk_size - App.state.max_waste and - not wildcard_size then - if not App.ui:confirm(_( - "Note: the total number of sectors needed " .. - "for the requested partitions (%d) does not make " .. - "full use of the number of sectors available " .. - "on the disk (%d.) There will be %d unused " .. - "sectors (%s.)\n\n" .. - "You may wish to expand one or more partitions " .. - "before proceeding.\n\n" .. - "Proceed anyway?", - used_size, disk_size, disk_size - used_size, - StorageDescriptor.format_capstring(disk_size - used_size))) then - return false - end - end - - return true -end - --- --- This assumes check_datasets has already been called. --- -local create_partitions_from_datasets = function(dd, list) - local i, dataset - local part_no = 1 - local offset = 60 - local disk_size = dd:get_raw_size() - local used_size = offset - local size - local sysid - - dd:clear_parts() - - for i, dataset in list do - used_size = used_size + - StorageDescriptor.parse_capstring(dataset.capstring, 0) - end - - for i, dataset in list do - size = StorageDescriptor.parse_capstring(dataset.capstring, - disk_size - used_size) - - dd:add_part(PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = offset, - size = size, - sysid = name_to_sysid_map[dataset.sysid] or tonumber(dataset.sysid), - active = (dataset.active == "Y") - }) - - offset = offset + size - part_no = part_no + 1 - end - - return true -end - -local do_edit_partitions = function(fsm) - if edit_partitions(fsm) then - local cmds = CmdChain.new() - - if check_datasets(App.state.sel_disk, datasets_list) and - create_partitions_from_datasets( - App.state.sel_disk, datasets_list) then - - App.state.sel_disk:cmds_partition(cmds) - cmds:execute() - - -- refresh our knowledge of the storage - App.state.sel_disk, App.state.sel_part = - App.state.storage:resurvey( - App.state.sel_disk, App.state.sel_part - ) - - -- Mark this disk as having been 'touched' - -- (modified destructively, i.e. partitioned) - -- by us. - if App.state.sel_disk then - App.state.sel_disk:touch() - end - - return fsm:next() - else - return fsm:current() - end - else - return fsm:prev() - end -end - -return { - name = "partition_disk", - title = "Partition Disk", - action = function(fsm) - local choices = {} - - if App.state.sel_disk:has_been_touched() then - return do_edit_partitions(fsm) - end - - if App.state.sel_disk:get_part_count() == 0 then - App.ui:inform(_( - "No valid partitions were found on this disk. " .. - "You will have to create at least one in which " .. - "to install %s.", - App.os.name - )) - return do_edit_partitions(fsm) - end - - choices[_("Format and Partition Disk")] = function() - return do_edit_partitions(fsm) - end - - choices[_("Skip this Step")] = function() - return fsm:next() - end - - choices[_("Return to %s", fsm:prev().title)] = function() - return fsm:prev() - end - - return App.ui:select(_( - "You may now format and partition this disk if you desire." .. - "\n\n" .. - "If this is a brand new disk, you should do this. If you " .. - "would like to place multiple operating systems on this disk, " .. - "you should create multiple partitions, one for each operating " .. - "system." .. - "\n\n" .. - "If this disk already has operating systems on it that you wish " .. - "to keep, you should NOT do this, and should skip this step." .. - "\n\n" .. - "Format and partition this disk?"), - choices - )() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/270_install_bootblocks.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/270_install_bootblocks.lua deleted file mode 100644 index 447623ac82..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/270_install_bootblocks.lua +++ /dev/null @@ -1,110 +0,0 @@ --- $Id: 270_install_bootblocks.lua,v 1.6 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "install_bootblocks", - title = "Install Bootblocks", - action = function(fsm) - local datasets_list = {} - local dataset - local dd - local disk_ref = {} -- map from raw name to ref to DiskDescriptor - - for dd in App.state.storage:get_disks() do - local raw_name = dd:get_raw_device_name() - - disk_ref[raw_name] = dd - - dataset = { - disk = raw_name, - boot0cfg = "Y", - packet = "N" - } - - if dd:get_capacity() > 8192 then - dataset.packet = "Y" - end - - table.insert(datasets_list, dataset) - end - - local response = App.ui:present({ - id = "install_bootstrap", - name = _("Install Bootblock(s)"), - short_desc = _( - "You may now wish to install bootblocks on one or more disks. " .. - "If you already have a boot manager installed, you can skip " .. - "this step (but you may have to configure your boot manager " .. - "separately.) If you installed %s on a disk other " .. - "than your first disk, you will need to put the bootblock " .. - "on at least your first disk and the %s disk.", - App.os.name, App.os.name), - long_desc = _( - "'Packet Mode' refers to using newer BIOS calls to boot " .. - "from a partition of the disk. It is generally not " .. - "required unless:\n\n" .. - "- your BIOS does not support legacy mode; or\n" .. - "- your %s primary partition resides on a " .. - "cylinder of the disk beyond cylinder 1024; or\n" .. - "- you just can't get it to boot without it.", - App.os.name - ), - special = "bsdinstaller_install_bootstrap", - - fields = { - { - id = "disk", - name = _("Disk Drive"), - short_desc = _("The disk on which you wish to install a bootblock"), - editable = "false" - }, - { - id = "boot0cfg", - name = _("Install Bootblock?"), - short_desc = _("Install a bootblock on this disk"), - control = "checkbox" - }, - { - id = "packet", - name = _("Packet mode?"), - short_desc = _("Select this to use 'packet mode' to boot the disk"), - control = "checkbox" - } - }, - - actions = { - { - id = "ok", - name = _("Accept and Install Bootblocks") - }, - { - id = "cancel", - name = _("Skip this Step") - } - }, - - datasets = datasets_list, - - multiple = "true", - extensible = "false" - }) - - if response.action_id == "ok" then - local cmds = CmdChain.new() - local i - - for i, dataset in response.datasets do - if dataset.boot0cfg == "Y" then - dd = disk_ref[dataset.disk] - dd:cmds_install_bootblock(cmds, - (dataset.packet == "Y")) - end - end - - cmds:execute() - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/300_select_part.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/300_select_part.lua deleted file mode 100644 index 7007ff08d2..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/300_select_part.lua +++ /dev/null @@ -1,101 +0,0 @@ --- $Id: 300_select_part.lua,v 1.17 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" -require "storage_ui" - -return { - name = "select_part", - title = "Select Partition", - action = function(fsm) - App.state.sel_part = nil - - local pd = StorageUI.select_part({ - dd = App.state.sel_disk, - short_desc = _( - "Select the primary partition of %s (also " .. - "known as a `slice' in the BSD tradition) on " .. - "which to install %s.", - App.state.sel_disk:get_name(), - App.os.name), - cancel_desc = _("Return to %s", fsm:prev().title) - }) - - if pd then - if pd:is_mounted() then - App.ui:inform( - _("One or more subpartitions on the selected " .. - "primary partition already in use (they are " .. - "currently mounted in the filesystem.) " .. - "You should either unmount them before " .. - "proceeding, or select a different partition " .. - "or disk on which to install %s.", App.os.name)) - return fsm:current() - end - - if pd:get_activated_swap() > 0 then - local choices = {} - - choices[_("Reboot")] = "reboot" - choices[_("Return to %s", fsm:prev().title)] = fsm:prev() - - return App.ui:select( - _("Some subpartitions on the selected primary " .. - "partition are already activated as swap. " .. - "Since there is no way to deactivate swap in " .. - "%s once it is activated, in order " .. - "to edit the subpartition layout of this " .. - "primary partition, you must first reboot.", - App.os.name), choices) - end - - App.state.sel_part = pd - - if pd:get_capacity() < App.state.disk_min then - App.ui:inform(_( - "WARNING: you should have a primary " .. - "partition at least %dM in size, or " .. - "you may encounter problems trying to " .. - "install %s.", - App.state.disk_min, App.os.name) - ) - end - - if App.state.sel_disk:has_been_touched() or - App.ui:confirm(_( - "WARNING! ALL data in primary partition #%d,\n\n%s\n\non the " .. - "disk\n\n%s\n\n will be IRREVOCABLY ERASED!\n\nAre you " .. - "ABSOLUTELY SURE you wish to take this action? This is " .. - "your LAST CHANCE to cancel!", - pd:get_number(), pd:get_desc(), - App.state.sel_disk:get_desc())) then - local cmds = CmdChain.new() - - pd:cmds_format(cmds) - if cmds:execute() then - App.ui:inform(_( - "Primary partition #%d was formatted.", - pd:get_number()) - ) - return fsm:next() - else - App.ui:inform(_( - "Primary partition #%d was " .. - "not correctly formatted, and may " .. - "now be in an inconsistent state. " .. - "We recommend re-formatting it " .. - "before proceeding.", - pd:get_number()) - ) - return fsm:current() - end - else - App.ui:inform(_( - "Action cancelled - " .. - "no primary partitions were formatted.")) - return fsm:prev() - end - else - return fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/400_select_subparts.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/400_select_subparts.lua deleted file mode 100644 index 5fd51ba9d4..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/400_select_subparts.lua +++ /dev/null @@ -1,393 +0,0 @@ --- $Id: 400_select_subparts.lua,v 1.24 2005/03/29 13:12:43 den Exp $ - -local expert_mode = false - -local datasets_list = nil - -local fillout_missing_expert_values = function() - local i, size - - for i in datasets_list do - local dataset = datasets_list[i] - - if not dataset.softupdates and - not dataset.fsize and not dataset.bsize then - if dataset.mountpoint == "/" then - dataset.softupdates = "N" - else - dataset.softupdates = "Y" - end - - size = StorageDescriptor.parse_capstring(dataset.capstring, -1) - if size and size < (1024 * 1024 * 1024) then - dataset.fsize = "1024" - dataset.bsize = "8192" - else - dataset.fsize = "2048" - dataset.bsize = "16384" - end - end - end -end - -local warn_subpartition_selections = function(pd) - local omit = "" - local consequences = "" - - if not pd:get_subpart_by_mountpoint("/var") then - omit = omit .. "/var " - consequences = consequences .. - _("%s will be a plain dir in %s\n", "/var", "/") - end - - if not pd:get_subpart_by_mountpoint("/usr") then - omit = omit .. "/usr " - consequences = consequences .. - _("%s will be a plain dir in %s\n", "/usr", "/") - end - - if not pd:get_subpart_by_mountpoint("/tmp") then - omit = omit .. "/tmp " - consequences = consequences .. - _("%s will be symlinked to %s\n", "/tmp", "/var/tmp") - end - - if not pd:get_subpart_by_mountpoint("/home") then - omit = omit .. "/home " - consequences = consequences .. - _("%s will be symlinked to %s\n", "/home", "/usr/home") - end - - if string.len(omit) > 0 then - local choices = {} - - choices[_("Omit Subpartition(s)")] = true - choices[_("Return to Create Subpartitions")] = false - - return App.ui:select(_( - "You have elected to not have the following " .. - "subpartition(s):\n\n%s\n\n" .. - "The ramifications of these subpartition(s) being " .. - "missing will be:\n\n%s\n" .. - "Is this really what you want to do?", - omit, consequences), choices) - else - return true - end -end - -local validate_subpart_descriptors = function(pd) - local spd, k, v - local part_size = pd:get_size() - local used_size = 0 - local min_size = {} - - -- XXX this should come from a config file. - for k, v in { - ["/"] = "70M", - ["/var"] = "8M", - ["/usr"] = "174M" - } do - min_size[k] = StorageDescriptor.parse_capstring(v, 0) or 0 - end - - -- - -- If the user didn't select a /usr partition, / is going to - -- have to hold all that stuff - so make sure it's big enough. - -- - if not pd:get_subpart_by_mountpoint("/usr") then - min_size["/"] = min_size["/"] + min_size["/usr"] - end - - for spd in pd:get_subparts() do - local spd_size = spd:get_size() - local mtpt = spd:get_mountpoint() - local min_mt_size = min_size[mtpt] - - used_size = used_size + spd_size - - if min_mt_size and spd_size < min_mt_size then - if not App.ui:confirm(_( - "WARNING: the %s subpartition should " .. - "be at least %s in size or you will " .. - "risk running out of space during " .. - "the installation.\n\n" .. - "Proceed anyway?", - mtpt, - StorageDescriptor.format_capstring(min_mt_size))) then - return false - end - end - end - - if used_size > part_size then - if not App.ui:confirm(_( - "WARNING: The total number of sectors needed " .. - "for the requested subpartitions (%d) exceeds the " .. - "number of sectors available in the partition (%d) " .. - "by %d sectors (%s.)\n\n" .. - "This is an invalid configuration; we " .. - "recommend shrinking the size of one or " .. - "more subpartitions before proceeding.\n\n" .. - "Proceed anyway?", - used_size, part_size, used_size - part_size, - StorageDescriptor.format_capstring(used_size - part_size))) then - return false - end - end - - if used_size < part_size - App.state.max_waste then - if not App.ui:confirm(_( - "Note: the total capacity required " .. - "for the requested subpartitions (%s) does not make " .. - "full use of the capacity available in the " .. - "partition (%s.) %d sectors (%s) of space will go " .. - "unused.\n\n" .. - "You may wish to expand one or more subpartitions " .. - "before proceeding.\n\n" .. - "Proceed anyway?", - StorageDescriptor.format_capstring(used_size), - StorageDescriptor.format_capstring(part_size), - part_size - used_size, - StorageDescriptor.format_capstring(part_size - used_size))) then - return false - end - end - - if App.option.enable_crashdumps then - local num_swap_subparts = 0 - local num_dumponable = 0 - - for spd in pd:get_subparts() do - if spd:is_swap() then - num_swap_subparts = num_swap_subparts + 1 - if spd:get_capacity() >= App.state.store:get_ram() then - num_dumponable = num_dumponable + 1 - end - end - end - - if num_swap_subparts > 0 and num_dumponable == 0 then - if not App.ui:confirm(_( - "Note: none of the swap subpartitions that " .. - "you have selected are large enough to hold " .. - "the contents of memory, and thus cannot be " .. - "used to hold a crash dump (an image of the " .. - "computers' memory at the time of failure.) " .. - "Because this complicates troubleshooting, " .. - "we recommend that you increase the size of " .. - "one of your swap subpartitions.\n\n" .. - "Proceed anyway?", - mtpt, min_cap)) then - return false - end - end - end - - return warn_subpartition_selections(pd) -end - --- --- Take a list of tables representing the user's choices and --- create a matching set of subpartition descriptors under --- the given partition description from them. In the process, --- the desired subpartitions are checked for validity. --- -local create_subpart_descriptors = function(pd, list) - local i, letter, dataset - local size, offset, fstype - local total_size = 0 - local wildcard_size = false - - pd:clear_subparts() - - offset = 0 - for i, dataset in list do - if dataset.capstring == "*" then - if wildcard_size then - App.ui:inform(_( - "Only one subpartition may have " .. - "a capacity of '*'." - )) - return false - end - wildcard_size = true - end - size = StorageDescriptor.parse_capstring(dataset.capstring, 0) - if not size then - App.ui:inform(_( - "Capacity must either end in 'M' " .. - "for megabytes, 'G' for gigabytes, " .. - "or be '*' to indicate 'use all " .. - "remaining space.'" - )) - return false - end - total_size = total_size + size - end - - offset = 0 - for i, letter in ipairs({"a", "b", "d", "e", "f", "g", "h", "i", - "j", "k", "l", "m", "n", "o", "p" }) do - if i > table.getn(list) then break end - dataset = list[i] - - size = StorageDescriptor.parse_capstring(dataset.capstring, - pd:get_size() - total_size) - - if dataset.mountpoint == "swap" then - fstype = "swap" - else - fstype = "4.2BSD" - end - - pd:add_subpart(SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = tonumber(dataset.fsize), - bsize = tonumber(dataset.bsize), - mountpoint = dataset.mountpoint - }) - - offset = offset + size - end - - return validate_subpart_descriptors(pd) -end - -return { - name = "select_subparts", - title = "Select Subpartitions", - action = function(fsm) - local part_no, pd - local part_actions = {} - local i, letter - - if not datasets_list then - datasets_list = App.load_conf("mountpoints")( - App.state.sel_part:get_capacity(), - App.state.storage:get_ram() - ) - end - - local fields_list = { - { - id = "mountpoint", - name = _("Mountpoint") - }, - { - id = "capstring", - name = _("Capacity") - } - } - - local actions_list = { - { - id = "ok", - name = _("Accept and Create"), - effect = function() - return fsm:next() - end - }, - { - id = "cancel", - name = _("Return to %s", fsm:prev().title), - effect = function() - return fsm:prev() - end - } - } - - if expert_mode then - table.insert(fields_list, - { - id = "softupdates", - name = _("Softupdates?"), - control = "checkbox" - } - ) - table.insert(fields_list, - { - id = "fsize", - name = _("Frag Size") - } - ) - table.insert(fields_list, - { - id = "bsize", - name = _("Block Size") - } - ) - - table.insert(actions_list, - { - id = "switch", - name = _("Switch to Normal Mode"), - effect = function() - expert_mode = not expert_mode - return fsm:current() - end - } - ) - else - table.insert(actions_list, - { - id = "switch", - name = _("Switch to Expert Mode"), - effect = function() - expert_mode = not expert_mode - return fsm:current() - end - } - ) - end - - local response = App.ui:present({ - id = "select_subpartitions", - name = _("Select Subpartitions"), - short_desc = _("Set up the subpartitions (also known " .. - "as just `partitions' in BSD tradition) you want to " .. - "have on this primary partition.\n\n" .. - "For Capacity, use 'M' to indicate megabytes, 'G' to " .. - "indicate gigabytes, or a single '*' to indicate " .. - "'use the remaining space on the primary partition'."), - long_desc = _("Subpartitions further divide a primary partition for " .. - "use with %s. Some reasons you may want " .. - "a set of subpartitions are:\n\n" .. - "- you want to restrict how much data can be written " .. - "to certain parts of the primary partition, to quell " .. - "denial-of-service attacks; and\n" .. - "- you want to speed up access to data on the disk.", - App.os.name), - special = "bsdinstaller_create_subpartitions", - minimum_width = "64", - - actions = actions_list, - fields = fields_list, - datasets = datasets_list, - - multiple = "true", - extensible = "true" - }) - - -- remember these subpartition selections in case we come back here. - datasets_list = response.datasets - fillout_missing_expert_values() - - if response.action_id == "ok" then - if create_subpart_descriptors(App.state.sel_part, datasets_list) then - local cmds = CmdChain.new() - - App.state.sel_part:cmds_disklabel(cmds) - cmds:execute() - else - return fsm:current() - end - end - - return response.result - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/450_select_packages.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/450_select_packages.lua deleted file mode 100644 index 4a5a3dc8c2..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/450_select_packages.lua +++ /dev/null @@ -1,45 +0,0 @@ --- $Id: 450_select_packages.lua,v 1.4 2005/02/24 23:08:04 cpressey Exp $ - -require "package" -require "storage_ui" - -return { - name = "select_packages", - title = "Select Packages", - action = function(fsm) - local i, j, pkg, regexp - - if not App.state.sel_pkgs then - local pkg_list = Package.list_all("") - local def_pkgs = App.load_conf("def_pkgs") or {} - - App.state.sel_pkgs = {} - for i, pkg in pkg_list do - App.state.sel_pkgs[pkg] = false -- but present... - for j, regexp in def_pkgs do - if string.find(pkg, regexp) then - App.state.sel_pkgs[pkg] = true - end - end - end - end - - local ok, sel_pkgs = StorageUI.select_packages{ - name = _("Select Packages"), - short_desc = _("Select the packages you wish to install from " .. - "the LiveCD onto the HDD."), - checkbox_name = _("Install?"), - ok_name = _("Accept these Packages"), - cancel_name = _("Return to %s", fsm:prev().title), - - sel_pkgs = App.state.sel_pkgs - } - - if ok then - App.state.sel_pkgs = sel_pkgs - return fsm:next() - else - return fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/500_install_os.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/500_install_os.lua deleted file mode 100644 index 81ddcc1060..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/500_install_os.lua +++ /dev/null @@ -1,258 +0,0 @@ --- $Id: 500_install_os.lua,v 1.39 2005/04/05 07:37:20 cpressey Exp $ - -require "gettext" -require "target_system" - -return { - name = "install_os", - title = "Install OS", - action = function(fsm) - local spd, cmds - - -- - -- Final confirmation. - -- - if App.ui:present({ - id = "ready_to_install", - name = _("Ready to Install"), - short_desc = _( - "Everything is now ready to install the actual files which " .. - "comprise the %s operating system " .. - "on the selected partition of the selected disk.\n\n" .. - "Note that this process will take quite a while to finish. " .. - "You may wish to take a break now and come back to the " .. - "computer in a short while.", App.os.name), - actions = { - { - id = "ok", - name = _("Begin Installing Files") - }, - { - id = "cancel", - name = _("Return to %s", fsm:prev().title) - } - } - }).action_id ~= "ok" then - return fsm:prev() - end - - -- - -- If there is a target system mounted, unmount it before starting. - -- - if App.state.target ~= nil and App.state.target:is_mounted() then - if not App.state.target:unmount() then - App.ui:inform( - _("Warning: already-mounted target system could " .. - "not be correctly unmounted first.")) - return fsm:current() - end - end - - -- - -- Create a command chain. - -- - cmds = CmdChain.new() - - -- - -- Activate swap, if there is none activated so far. - -- - if App.state.storage:get_activated_swap() == 0 then - for spd in App.state.sel_part:get_subparts() do - if spd:get_fstype() == "swap" then - cmds:add{ - cmdline = "${root}${SWAPON} ${root}dev/${dev}", - replacements = { - dev = spd:get_device_name() - } - } - end - end - end - - -- - -- Mount the target system. This will create the - -- mountpoint directories the user asked for and - -- will mount their subpartitions on them. - -- - App.state.target = TargetSystem.new(App.state.sel_part, "mnt") - if not App.state.target:create() then - App.ui:inform( - _("Could not create the skeletal target system.") - ) - return fsm:current() - end - if not App.state.target:mount() then - App.ui:inform( - _("Could not mount the skeletal target system.") - ) - return fsm:current() - end - - -- - -- Create the commands which will install the chosen directories - -- onto the target system. - -- - App.state.target:cmds_install_srcs(cmds, App.load_conf("sources")) - - -- - -- If we were to copy /usr/local and /usr/X11R6 onto the HDD, - -- *all* packages installed on the LiveCD would be copied to - -- the HDD. This may not be what the user wants. So instead, - -- create an appropriate filesystem hierarchy under /usr/local - -- and /usr/X11R6 and populate them with only mandatory packages. - -- And first, remove the copied-over package database, as it is - -- inaccurate. - -- - cmds:add( - "${root}${RM} -rf ${root}mnt/var/db/pkg", - "${root}${MKDIR} -p ${root}mnt/var/db/pkg", - "${root}${CHMOD} 755 ${root}mnt/var/db/pkg", - "${root}${MKDIR} -p ${root}mnt/usr/local", - "${root}${MTREE} -deU -f ${root}etc/mtree/BSD.local.dist -p ${root}mnt/usr/local", - "${root}${MKDIR} -p ${root}mnt/usr/X11R6", - "${root}${MTREE} -deU -f ${root}etc/mtree/BSD.x11-4.dist -p ${root}mnt/usr/X11R6" - ) - - -- - -- Create symlinks. - -- - - -- - -- If the user has both /var and /tmp subparitions, - -- symlink /var/tmp to /tmp. - -- - if App.state.sel_part:get_subpart_by_mountpoint("/tmp") and - App.state.sel_part:get_subpart_by_mountpoint("/var") then - cmds:add( - "${root}${CHMOD} 1777 ${root}mnt/tmp", - "${root}${RM} -rf ${root}mnt/var/tmp", - "${root}${LN} -s /tmp ${root}mnt/var/tmp" - ) - end - - -- - -- If the user has /var, but no /tmp, - -- symlink /tmp to /var/tmp. - -- - if not App.state.sel_part:get_subpart_by_mountpoint("/tmp") and - App.state.sel_part:get_subpart_by_mountpoint("/var") then - cmds:add( - "${root}${RM} -rf ${root}mnt/tmp", - "${root}${LN} -s /var/tmp ${root}mnt/tmp" - ) - end - - -- - -- If the user has /usr, but no /home, - -- symlink /home to /usr/home. - -- - if not App.state.sel_part:get_subpart_by_mountpoint("/home") and - App.state.sel_part:get_subpart_by_mountpoint("/usr") then - cmds:add( - "${root}${RM} -rf ${root}mnt/home", - "${root}${MKDIR} ${root}mnt/usr/home", - "${root}${LN} -s /usr/home ${root}mnt/home" - ) - end - - -- - -- Clean up. In case some file didn't make it, use rm -f - -- - if App.os == "DragonFly" then - cmds:add("${root}${RM} -f ${root}mnt/boot/loader.conf") - end - cmds:set_replacements{ - logfile = App.log_filename, - part = App.state.sel_part:get_device_name() - } - cmds:add("${root}${RM} -f ${root}mnt/tmp/${logfile}") - - -- - -- Create missing directories. - -- - cmds:add( - "${root}${MKDIR} ${root}mnt/proc", - "${root}${MKDIR} ${root}mnt/mnt" - ) - - -- - -- Write the fstab. - -- - App.state.sel_part:cmds_write_fstab(cmds, "${root}mnt/etc/fstab") - - -- - -- If it was enabled and selected, write the crash device - -- in the user's new rc.conf file on the HDD. - -- - if App.state.crash_device ~= nil then - local cv = ConfigVars.new() - - cv:set("dumpdev", "/dev/" .. App.state.crash_device) - cv:set("dumpdir", "/var/crash") - cv:write(App.expander:expand("${root}mnt/etc/rc.conf"), "sh") - end - - -- - -- Install requested packages. - -- - if App.state.sel_pkgs ~= nil then - local pkg_name, selected - local pkg_seen = {} - local n, i = 0, 0 - local pr = App.ui:new_progress_bar{ - title = _("Calculating package dependencies...") - } - - for pkg_name, selected in App.state.sel_pkgs do - if selected then - n = n + 1 - end - end - - pr:start() - for pkg_name, selected in App.state.sel_pkgs do - if selected then - Package.cmds_copy( - "mnt/", cmds, pkg_name, pkg_seen - ) - i = i + 1 - pr:set_amount((i * 100) / n) - pr:update() - end - end - pr:stop() - end - - -- - -- Backup the disklabel and the log. - -- - cmds:add( - "${root}${DISKLABEL} ${part} >${root}mnt/etc/disklabel.${part}", - "${root}${CP} ${tmp}${logfile} ${root}mnt/var/log/${logfile}", - "${root}${CHMOD} 600 ${root}mnt/var/log/${logfile}" - ) - - -- - -- Do it! - -- - if cmds:execute() then - -- - -- If the install went successfully, - -- make sure once and for all that the disklabel is bootable. - -- - cmds = CmdChain.new() - App.state.sel_part:cmds_install_bootstrap(cmds) - if not cmds:execute() then - App.ui:inform( - _("Failed to make sure that the partition is bootable.") - ) - end - return fsm:next() - else - App.ui:inform( - _("%s was not fully installed.", App.os.name) - ) - return fsm:current() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/700_install_bootblocks.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/700_install_bootblocks.lua deleted file mode 100644 index 93bf0d24bf..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/700_install_bootblocks.lua +++ /dev/null @@ -1,110 +0,0 @@ --- $Id: 700_install_bootblocks.lua,v 1.6 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "install_bootblocks", - title = "Install Bootblocks", - action = function(fsm) - local datasets_list = {} - local dataset - local dd - local disk_ref = {} -- map from raw name to ref to DiskDescriptor - - for dd in App.state.storage:get_disks() do - local raw_name = dd:get_raw_device_name() - - disk_ref[raw_name] = dd - - dataset = { - disk = raw_name, - boot0cfg = "Y", - packet = "N" - } - - if dd:get_capacity() > 8192 then - dataset.packet = "Y" - end - - table.insert(datasets_list, dataset) - end - - local response = App.ui:present({ - id = "install_bootstrap", - name = _("Install Bootblock(s)"), - short_desc = _( - "You may now wish to install bootblocks on one or more disks. " .. - "If you already have a boot manager installed, you can skip " .. - "this step (but you may have to configure your boot manager " .. - "separately.) If you installed %s on a disk other " .. - "than your first disk, you will need to put the bootblock " .. - "on at least your first disk and the %s disk.", - App.os.name, App.os.name), - long_desc = _( - "'Packet Mode' refers to using newer BIOS calls to boot " .. - "from a partition of the disk. It is generally not " .. - "required unless:\n\n" .. - "- your BIOS does not support legacy mode; or\n" .. - "- your %s primary partition resides on a " .. - "cylinder of the disk beyond cylinder 1024; or\n" .. - "- you just can't get it to boot without it.", - App.os.name - ), - special = "bsdinstaller_install_bootstrap", - - fields = { - { - id = "disk", - name = _("Disk Drive"), - short_desc = _("The disk on which you wish to install a bootblock"), - editable = "false" - }, - { - id = "boot0cfg", - name = _("Install Bootblock?"), - short_desc = _("Install a bootblock on this disk"), - control = "checkbox" - }, - { - id = "packet", - name = _("Packet mode?"), - short_desc = _("Select this to use 'packet mode' to boot the disk"), - control = "checkbox" - } - }, - - actions = { - { - id = "ok", - name = _("Accept and Install Bootblocks") - }, - { - id = "cancel", - name = _("Skip this Step") - } - }, - - datasets = datasets_list, - - multiple = "true", - extensible = "false" - }) - - if response.action_id == "ok" then - local cmds = CmdChain.new() - local i - - for i, dataset in response.datasets do - if dataset.boot0cfg == "Y" then - dd = disk_ref[dataset.disk] - dd:cmds_install_bootblock(cmds, - (dataset.packet == "Y")) - end - end - - cmds:execute() - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/800_finished.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/800_finished.lua deleted file mode 100644 index 8bbf5dc9a6..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/800_finished.lua +++ /dev/null @@ -1,50 +0,0 @@ --- $Id: 800_finished.lua,v 1.8 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "finished", - title = "Finished", - action = function(fsm) - return App.ui:present({ - id = "finished_install", - name = _("%s is now installed", App.os.name), - short_desc = _("Congratulations, %s is now installed " .. - "on your hard drive! You may now do one " .. - "of three things: you can perform some " .. - "initial configuration of this system, you " .. - "can reboot to test out your new " .. - "installation, or you can go back to the " .. - "main menu and select other actions to " .. - "perform.", - App.os.name), - actions = { - { - id = "configure", - name = _("Configure"), - short_desc = _("Configure the system that was just installed"), - effect = function() - App.descend("../configure/menu") - return nil - end - }, - { - id = "reboot", - name = _("Reboot"), - short_desc = _("Reboot this computer"), - effect = function() - return fsm:next() - end - }, - { - id = "cancel", - name = _("Return to Main Menu"), - short_desc = _("Return to Main Menu"), - effect = function() - return nil - end - } - } - }).result - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/900_reboot.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/900_reboot.lua deleted file mode 100644 index f2669aebce..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/900_reboot.lua +++ /dev/null @@ -1,33 +0,0 @@ --- $Id: 900_reboot.lua,v 1.7 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "reboot", - title = "Reboot", - action = function() - local response = App.ui:present({ - id = "reboot", - name = _("Reboot"), - short_desc = _("This machine is about to be shut down. " .. - "After the machine has reached its shutdown state, " .. - "you may remove the CD from the CD-ROM drive tray " .. - "and press Enter to reboot from the HDD."), - role = "confirm", - actions = { - { - id = "ok", - name = _("Reboot"), - }, - { - id = "cancel", - name = _("Return to Main Menu"), - } - } - }) - - App.state.do_reboot = (response.action_id == "ok") - - return nil - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/install/main.lua deleted file mode 100644 index 99f4156941..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/install/main.lua +++ /dev/null @@ -1,13 +0,0 @@ --- demo/install/main.lua --- $Id: main.lua,v 1.4 2005/02/24 23:08:04 cpressey Exp $ --- Main segment of the demonstration fake install program. - -require "fsm" - --- these are really more like settings... --- and as such should go in a config file... -App.state.disk_min = 300 -- minimum space (in MB) req'd for install -App.state.max_waste = 8192 -- maximum # sectors to allow to go to waste - -- when defining partitions/subpartitions - -FSM.auto("welcome") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Bitwise.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Bitwise.lua deleted file mode 100644 index 460a2a6dab..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Bitwise.lua +++ /dev/null @@ -1,43 +0,0 @@ --- lib/bitwise.lua --- $Id: Bitwise.lua,v 1.1 2005/02/22 02:54:32 cpressey Exp $ --- Package for (pure-Lua portable but extremely slow) bitwise arithmetic. - --- BEGIN lib/bitwise.lua -- - ---[[---------]]-- ---[[ Bitwise ]]-- ---[[---------]]-- - -local odd = function(x) - return x ~= math.floor(x / 2) * 2 -end - -Bitwise = {} - -Bitwise.bw_and = function(a, b) - local c, pow = 0, 1 - while a > 0 or b > 0 do - if odd(a) and odd(b) then - c = c + pow - end - a = math.floor(a / 2) - b = math.floor(b / 2) - pow = pow * 2 - end - return c -end - -Bitwise.bw_or = function(a, b) - local c, pow = 0, 1 - while a > 0 or b > 0 do - if odd(a) or odd(b) then - c = c + pow - end - a = math.floor(a / 2) - b = math.floor(b / 2) - pow = pow * 2 - end - return c -end - --- END of lib/bitwise.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Capacity.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Capacity.lua deleted file mode 100644 index ec5946be74..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Capacity.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: Capacity.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/CmdChain.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/CmdChain.lua deleted file mode 100644 index ec44e34b9f..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/CmdChain.lua +++ /dev/null @@ -1,467 +0,0 @@ --- $Id: CmdChain.lua,v 1.33 2005/03/26 23:36:13 cpressey Exp $ - -require "app" - ---[[-----------]]-- ---[[ CmdChains ]]-- ---[[-----------]]-- - --- Global "class" variable: -CmdChain = {} - --- Some 'symbolic constants': -CmdChain.LOG_SILENT = {} -CmdChain.LOG_QUIET = {} -CmdChain.LOG_VERBOSE = {} - -CmdChain.FAILURE_IGNORE = {} -CmdChain.FAILURE_WARN = {} -CmdChain.FAILURE_ABORT = {} - -CmdChain.RESULT_NEVER_EXECUTED = {} -CmdChain.RESULT_POPEN_ERROR = {} -CmdChain.RESULT_SELECT_ERROR = {} -CmdChain.RESULT_CANCELLED = {} -CmdChain.RESULT_SKIPPED = {} - --- Create a new command chain object instance. -CmdChain.new = function(...) - local chain = {} - local cmds = {} - local capture = {} - local replacements = {} - - -- - -- Private functions. - -- - - -- Fix up a command descriptor. If it is just a string, turn - -- it into a table; fill out any missing default values in the - -- table; and expand the string as appropriate. - local fix_cmd = function(cmd) - if type(cmd) == "string" then - cmd = { cmdline = cmd } - end - assert(type(cmd) == "table") - - if cmd.cmdline == nil then - cmd.cmdline = "" - end - assert(type(cmd.cmdline) == "string") - - if cmd.log_mode == nil then - cmd.log_mode = CmdChain.LOG_VERBOSE - end - assert(cmd.log_mode == CmdChain.LOG_SILENT or - cmd.log_mode == CmdChain.LOG_QUIET or - cmd.log_mode == CmdChain.LOG_VERBOSE) - - if cmd.failure_mode == nil then - cmd.failure_mode = CmdChain.FAILURE_ABORT - end - assert(cmd.failure_mode == CmdChain.FAILURE_IGNORE or - cmd.failure_mode == CmdChain.FAILURE_WARN or - cmd.failure_mode == CmdChain.FAILURE_ABORT) - - if cmd.replacements == nil then - cmd.replacements = {} - end - assert(type(cmd.replacements) == "table") - - cmd.cmdline = App.expand(cmd.cmdline, - cmd.replacements, replacements) - - cmd.display_cmdline = cmd.cmdline - - if cmd.on_executed ~= nil then - assert(type(cmd.on_executed) == "function") - end - - -- cmd.desc, cmd.tag, cmd.sensitive, cmd.on_executed, - -- and cmd.input are left as nil if not specified. - - return cmd - end - - -- Open a stream to a command to be executed, read from it, - -- and update the progress bar as data comes and (and/or as the - -- read from the stream times out.) - - -- Returns: - -- - the return value of the command on the other end of the stream; - -- - a boolean indicating whether it was cancelled by the user; and - -- - the output of the command, if requested (cmd.capture.) - - local stream_loop = function(pr, cmd) - local done = false - local cancelled = false - local pty - local output = {} - local cmdline - - local escape = function(pat) - return string.gsub(pat, "([^%w])", "%%%1") - end - - cmdline = "(" .. cmd.cmdline .. ") 2>&1" - if not cmd.input then - cmdline = cmdline .. " >> Exit status: " .. tostring(result)) - end - - if cancelled then - pr:stop() - done_command, result = interruption_dialog(cmd, cancelled, result) - pr:start() - elseif cmd.failure_mode == CmdChain.FAILURE_IGNORE then - result = 0 - done_command = true - elseif (result ~= 0 and cmd.failure_mode ~= CmdChain.FAILURE_WARN) then - pr:stop() - done_command, result = interruption_dialog(cmd, cancelled, result) - pr:start() - else - done_command = true - end - end - if cmd.on_executed ~= nil then - cmd.on_executed(cmd, result, output) - end - - return result, output - end - - -- - -- Methods. - -- - - -- - -- Set the global replacements for this command chain. - -- These will be applied to each command that is - -- subsequently added (although local replacements will - -- be applied first.) - -- - chain.set_replacements = function(cmd, new_replacements) - App.merge_tables(replacements, new_replacements, - function(key, dest_val, src_val) - return src_val - end) - end - - -- - -- Get captured output by its id. - -- - chain.get_output = function(cmd, cap_id) - return capture[cap_id] - end - - -- - -- Add one or more commands to this command chain. - -- - chain.add = function(chain, ...) - local cmd_no, cmd - - if table.getn(arg) == 0 then - return - end - - for cmd_no, cmd in ipairs(arg) do - table.insert(cmds, fix_cmd(cmd)) - end - end - - -- Execute a series of external utility programs. - -- Returns 1 if everything executed OK, 0 if one of the - -- critical commands failed or if the user cancelled. - chain.execute = function(chain) - local pr - local cmd - local i, n, result = 0, 0, 0 - local return_val = true - local output - - n = table.getn(cmds) - - pr = App.ui:new_progress_bar{ - title = "Executing Commands" - } - - pr:start() - - for i in cmds do - result, output = command_execute(pr, cmds[i]) - if result == CmdChain.RESULT_CANCELLED then - return_val = false - break - end - if type(result) == "number" and result > 0 and result < 256 then - return_val = false - if cmd.failure_mode == CmdChain.FAILURE_ABORT then - break - end - end - if cmds[i].capture then - capture[cmds[i].capture] = output - end - pr:set_amount((i * 100) / n) - end - - pr:stop() - - return return_val - end - - -- Show the commands that have been added to this - -- command chain to the user in a dialog box. - chain.preview = function(chain) - local contents = "" - local i, cmd - - for i, cmd in cmds do - contents = contents .. cmd.cmdline .. "\n" - end - - App.ui:present({ - id = "cmd_preview", - name = "Command Preview", - short_desc = contents, - role = "informative", - minimum_width = "72", - monospaced = "true", - actions = { - { id = "ok", name = "OK" } - } - }) - end - - -- Record these commands in a shell script file. - chain.record = function(chain, file) - local contents = "" - local i, cmd - - local gen_rand_string = function(len) - local n = 1 - local s = "" - local A = string.byte("A") - assert(len >= 0) - - while n <= len do - s = s .. string.char(math.random(A, A + 25)) - n = n + 1 - end - - return s - end - - local get_marker_for = function(text) - local s - - s = gen_rand_string(5) - while string.find(text, s, 1, true) do - s = gen_rand_string(5) - end - return s - end - - for i, cmd in cmds do - -- - -- Write lines apropos to the cmdline being - -- executed, taking in account the failure mode. - -- - if cmd.failure_mode == CmdChain.FAILURE_IGNORE then - file:write(cmd.cmdline) - elseif cmd.failure_mode == CmdChain.FAILURE_WARN then - file:write("(" .. cmd.cmdline .. " || " .. - "echo \"WARNING: " .. cmd.cmdline .. - " failed with exit code $?\")") - elseif cmd.failure_mode == CmdChain.FAILURE_ABORT then - file:write(cmd.cmdline) - end - - -- - -- If the command has input, include that as a heredoc. - - if cmd.input then - local marker = get_marker_for(cmd.input) - file:write(" <<" .. marker .. "\n" .. cmd.input .. marker) - end - - if cmd.failure_mode == CmdChain.FAILURE_WARN or - cmd.failure_mode == CmdChain.FAILURE_ABORT then - file:write(" && \\") - end - - -- - -- Write the description as a comment following. - -- - if cmd.desc then - file:write(" # " .. cmd.desc) - end - - file:write("\n") - end - end - - -- ``Constructor'' - initialize our instance data. - - if table.getn(arg) > 0 then - chain:add(unpack(arg)) - end - - return chain -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/ConfigFile.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/ConfigFile.lua deleted file mode 100644 index 433a04696f..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/ConfigFile.lua +++ /dev/null @@ -1,105 +0,0 @@ --- $Id: ConfigFile.lua,v 1.1 2004/11/28 03:52:05 cpressey Exp $ - -require "app" -require "cmdchain" - ---[[------------]]-- ---[[ ConfigVars ]]-- ---[[------------]]-- - -ConfigVars = {} -ConfigVars.new = function() - local cv = {} - local var = {} - - cv.get = function(cv, name) - return var[name] - end - - cv.set = function(cv, name, value) - var[name] = value - end - - -- - -- Populate this set of variables from a file. - -- - -- This isn't perfect. It doesn't handle variables - -- with embedded newlines, for example. It also - -- has to execute the script, which is undesirable. - -- - cv.read = function(cv, filename, filetype) - local cmds = CmdChain.new() - local diff, i - - cmds:add( - "set | ${root}${SORT} >${tmp}env.before", - { - cmdline = ". ${filename} && set | ${root}${SORT} >${tmp}env.after", - replacements = { - filename = filename - } - }, - { - cmdline = "${root}${COMM} -1 -3 ${tmp}env.before ${tmp}env.after", - capture = "comm" - }, - "${root}${RM} -f ${tmp}env.before ${tmp}env.after" - ) - - if not cmds:execute() then - return false - end - - diff = cmds:get_output("comm") - for i in diff do - local found, ends, k, v - - found, ends, k, v = - string.find(diff[i], "^([^=]+)='(.*)'$") - if found then - cv:set(k, v) - else - found, ends, k, v = - string.find(diff[i], "^([^=]+)=(.*)$") - if found then - cv:set(k, v) - end - end - end - - return true - end - - -- Write this set of configuration variable settings to a file. - cv.write = function(cv, filename, filetype) - local k, v - local file = io.open(filename, "a") - local written = false - - if not file then - return false - end - - for k, v in var do - if not written then - written = true - file:write("\n") - file:write("# -- BEGIN BSD Installer automatically generated configuration -- #\n") - file:write("# -- Written on " .. os.date() .. " -- #\n") - end - - file:write(k .. "='" .. v.. "'\n") - end - - if written then - file:write("# -- END of BSD Installer " .. - "automatically generated configuration -- #\n") - end - - file:close() - - return true - end - - return cv -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Disk.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Disk.lua deleted file mode 100644 index dc91fb10a6..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Disk.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: Disk.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Flow.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Flow.lua deleted file mode 100644 index b2fd54ff72..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Flow.lua +++ /dev/null @@ -1,149 +0,0 @@ --- lib/fsm.lua --- $Id: Flow.lua,v 1.18 2005/03/29 21:04:19 cpressey Exp $ --- Framework for simple Finite State Machines in Lua. - --- BEGIN lib/fsm.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - --- Global "class" variable: -FSM = {} - --- Global "static methods": - --- Create a new FSM object instance. --- This object can then have states added to it with --- fsm:register(StateName, Function), and can be run --- with fsm:run(InitialStateName). -FSM.new = function() - local fsm = {} - local state = {} -- a dictionary of state name -> state - local sequence = {} -- an array of state number -> state - local current_state = nil -- reference to the current state - - fsm.register = function(fsm, tab) - state[tab.name] = { - name = tab.name, - title = tab.title, - action = tab.action, - position = table.getn(sequence) + 1 - } - table.insert(sequence, state[tab.name]) - end - - fsm.next = function(fsm) - return sequence[current_state.position + 1] - end - - fsm.prev = function(fsm) - return sequence[current_state.position - 1] - end - - fsm.current = function(fsm) - return current_state - end - - local resolve_state = function(x) - if type(x) == "string" then - if state[x] then - return state[x] - else - error("No state named '" .. x .. - "' exists in FSM") - end - elseif type(x) == "number" then - if sequence[x] then - return sequence[x] - else - error("No state number " .. tostring(x) .. - " exists in FSM") - end - elseif x == nil then - return nil - elseif type(x) == "table" then - local i, v - - for i, v in state do - if x == v then - return x - end - end - error("State object `" .. tostring(x) .. - "' does not exist in FSM") - end - error("Invalid state reference: " .. tostring(x)) - end - - fsm.run = function(fsm, start_state) - local result - - current_state = resolve_state(start_state) - while current_state do - if type(current_state.action) ~= "function" then - error("State '" .. current_state.name .. - "' does not define an action function") - else - result = current_state.action(fsm) - current_state = resolve_state(result) - end - end - end - - -- Note that we only return the table of functions; - -- we do not return the state table. However, a - -- reference ("upvalue" in Lua terminology) to the - -- state table is still carried along inside the - -- fsm function table; in this way it is retained, - -- and it is also protected from modification from - -- the outside (i.e. it is encapsulated.) - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the given directory. Each script --- should end with a return statement that returns a table --- describing the state. -FSM.from_dir = function(dir) - local fsm = FSM.new() - local file_no, files - local state, fun - local state_count = 0 - - files = POSIX.dir(dir) - table.sort(files) - - for file_no in files do - local full_file = dir .. "/" .. files[file_no] - local tab - - if files[file_no] ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(files[file_no], "^[^%.].*%.lua$") then - tab = App.run_script(full_file) - if tab then - fsm:register(tab) - state_count = state_count + 1 - end - end - end - - if state_count == 0 then - error("Directory " .. dir .. " should contain at least one FSM scriptlet") - end - - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -FSM.auto = function(start_state) - local path = FileName.dirname(App.current_script) - local fsm = FSM.from_dir(path) - - fsm:run(start_state) -end - --- END of lib/fsm.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/FlowStep.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/FlowStep.lua deleted file mode 100644 index c4693d3c35..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/FlowStep.lua +++ /dev/null @@ -1,149 +0,0 @@ --- lib/fsm.lua --- $Id: FlowStep.lua,v 1.18 2005/03/29 21:04:19 cpressey Exp $ --- Framework for simple Finite State Machines in Lua. - --- BEGIN lib/fsm.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - --- Global "class" variable: -FSM = {} - --- Global "static methods": - --- Create a new FSM object instance. --- This object can then have states added to it with --- fsm:register(StateName, Function), and can be run --- with fsm:run(InitialStateName). -FSM.new = function() - local fsm = {} - local state = {} -- a dictionary of state name -> state - local sequence = {} -- an array of state number -> state - local current_state = nil -- reference to the current state - - fsm.register = function(fsm, tab) - state[tab.name] = { - name = tab.name, - title = tab.title, - action = tab.action, - position = table.getn(sequence) + 1 - } - table.insert(sequence, state[tab.name]) - end - - fsm.next = function(fsm) - return sequence[current_state.position + 1] - end - - fsm.prev = function(fsm) - return sequence[current_state.position - 1] - end - - fsm.current = function(fsm) - return current_state - end - - local resolve_state = function(x) - if type(x) == "string" then - if state[x] then - return state[x] - else - error("No state named '" .. x .. - "' exists in FSM") - end - elseif type(x) == "number" then - if sequence[x] then - return sequence[x] - else - error("No state number " .. tostring(x) .. - " exists in FSM") - end - elseif x == nil then - return nil - elseif type(x) == "table" then - local i, v - - for i, v in state do - if x == v then - return x - end - end - error("State object `" .. tostring(x) .. - "' does not exist in FSM") - end - error("Invalid state reference: " .. tostring(x)) - end - - fsm.run = function(fsm, start_state) - local result - - current_state = resolve_state(start_state) - while current_state do - if type(current_state.action) ~= "function" then - error("State '" .. current_state.name .. - "' does not define an action function") - else - result = current_state.action(fsm) - current_state = resolve_state(result) - end - end - end - - -- Note that we only return the table of functions; - -- we do not return the state table. However, a - -- reference ("upvalue" in Lua terminology) to the - -- state table is still carried along inside the - -- fsm function table; in this way it is retained, - -- and it is also protected from modification from - -- the outside (i.e. it is encapsulated.) - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the given directory. Each script --- should end with a return statement that returns a table --- describing the state. -FSM.from_dir = function(dir) - local fsm = FSM.new() - local file_no, files - local state, fun - local state_count = 0 - - files = POSIX.dir(dir) - table.sort(files) - - for file_no in files do - local full_file = dir .. "/" .. files[file_no] - local tab - - if files[file_no] ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(files[file_no], "^[^%.].*%.lua$") then - tab = App.run_script(full_file) - if tab then - fsm:register(tab) - state_count = state_count + 1 - end - end - end - - if state_count == 0 then - error("Directory " .. dir .. " should contain at least one FSM scriptlet") - end - - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -FSM.auto = function(start_state) - local path = FileName.dirname(App.current_script) - local fsm = FSM.from_dir(path) - - fsm:run(start_state) -end - --- END of lib/fsm.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Installation.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Installation.lua deleted file mode 100644 index 4359f2fa30..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Installation.lua +++ /dev/null @@ -1,644 +0,0 @@ --- $Id: Installation.lua,v 1.25 2005/03/29 21:04:19 cpressey Exp $ - -local App = require("app") -local FileName = require("filename") -require "gettext" -require "cmdchain" -require "storage" -require "mountpoint" - ---[[--------------]]-- ---[[ TargetSystem ]]-- ---[[--------------]]-- - -TargetSystem = {} - --- --- There are three general use cases for this class. --- --- The first case is when mounting a virgin target system --- for a fresh install. In this situation, the needed --- mountpoint directories (taken from the subpartition descriptors --- in the partition descriptor) are created on the target system --- before being mounted: --- --- local ts = TargetSystem.new(pd, "mnt") --- if ts:create() then --- if ts:mount() then --- ... --- ts:unmount() --- end --- end --- --- The second case is when mounting an existing target system --- for configuration. In this situation, the root partition is --- mounted, then the file /etc/fstab on that partition is parsed, --- and everything that can reasonably be mounted from that is. --- --- local ts = TargetSystem.new(pd, "mnt") --- if ts:probe() then --- if ts:mount() then --- ... --- ts:unmount() --- end --- end --- --- The third case is when configuring the booted system, such as --- when the configurator may be started from the installed system --- itself. In this case, no mounting is necessary. But the target --- system must know that this is the case, so that it need not --- e.g. uselessly chroot to itself. --- --- local ts = TargetSystem.new(pd) --- if ts:use_current() then --- ... --- end --- -TargetSystem.new = function(pd, base) - local ts = {} -- instance variable - local fstab = nil -- our representation of fstab - local root_is_mounted = false -- flag: is the root fs mounted? - local is_mounted = false -- flag: is everything mounted? - local using_current = false -- flag: using booted system? - - -- - -- Private utility helper functions. - -- - - -- - -- Unmount all mountpoints under a given directory. Recursively unmounts - -- dependent mountpoints, so that unmount_all'ing /mnt will first unmount - -- /mnt/usr/local, then /mnt/usr, then /mnt itself. - -- - -- The third argument is generally not necessary when calling this function; - -- it is used only when it recursively calls itself. - -- - local unmount_all_under - unmount_all_under = function(cmds, dirname, fs_descs) - local unmount_me = false - local i - - if not dirname then - dirname = App.expand("${root}${base}", { - base = base - }) - dirname = FileName.remove_trailing_slash(dirname) - end - - if not fs_descs then - fs_descs = MountPoints.enumerate() - end - - for i, fs_desc in fs_descs do - if fs_desc.mountpoint == dirname then - unmount_me = true - end - - if string.sub(fs_desc.mountpoint, 1, string.len(dirname)) == dirname and - string.len(dirname) < string.len(fs_desc.mountpoint) then - unmount_all_under(cmds, fs_desc.mountpoint, fs_descs) - end - end - - if unmount_me then - cmds:add({ - cmdline = "${root}${UMOUNT} ${dirname}", - replacements = { dirname = dirname } - }) - end - end - - -- - -- Convert the options for swap-backed devices from their - -- fstab format to command line format. - -- - local convert_swap_options = function(opts) - local opt - local result = "" - - for opt in string.gfind(opts, "[^,]") do - -- - -- Honour options that begin with -, but - -- don't bother trying to honour the -C - -- option, since we can't copy files from - -- the right place anyway. - -- - if string.find(opt, "^-[^C]") then - result = result .. - string.gsub(opt, "=", " ") .. " " - end - end - - return result - end - - -- - -- Mount this TargetSystem's root filesystem. - -- Note: this doesn't just queue up commands, it actually does it. - -- This is necessary for reading /etc/fstab. - -- Any optimizations will come later... - -- - local mount_root_filesystem = function(ts) - local cmds, spd - - if root_is_mounted then - return false, "Root filesystem is already mounted" - end - - -- - -- Create a command chain. - -- - cmds = CmdChain.new() - - -- - -- Find the root subpartition of the partition. - -- It's always the first one, called "a". - -- - spd = pd:get_subpart_by_letter("a") - - -- - -- If there isn't one, then this partition isn't - -- correctly formatted. One possible cause is - -- an incomplete formatting operation; perhaps the - -- partition was disklabeled, but never newfs'ed. - -- - if not spd then - return false - end - - -- - -- Ensure that the devices we'll be using exist. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - spd:cmds_ensure_dev(cmds) - - -- - -- Make sure nothing is mounted under where we want - -- to mount this filesystem. - -- - unmount_all_under(cmds) - - -- - -- Mount the target's root filesystem - -- - cmds:add({ - cmdline = "${root}${MOUNT} ${root}dev/${dev} ${root}${base}", - replacements = { - dev = spd:get_device_name(), - base = base - } - }) - - -- - -- Do it. - -- - root_is_mounted = cmds:execute() - return root_is_mounted - end - - -- - -- Accessor methods. - -- - - ts.get_part = function(ts) - return(pd) - end - - ts.get_base = function(ts) - return(base) - end - - ts.is_mounted = function(ts) - return(is_mounted) - end - - -- - -- Command-generating methods. - -- - - ts.cmds_set_password = function(ts, cmds, username, password) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PW} usermod ${username} -h 0", - replacements = { - base = base, - username = username - }, - desc = _("Setting password for user `%s'...", username), - input = password .. "\n", - sensitive = password - }) - end - - ts.cmds_add_user = function(ts, cmds, tab) - - local add_flag = function(flag, setting) - if setting ~= nil and setting ~= "" then - return flag .. " " .. tostring(setting) - else - return "" - end - end - - local home_skel = "" - if not tab.home or not FileName.is_dir(tab.home) then - home_skel = "-m -k /usr/share/skel" - end - - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PW} useradd " .. - "'${username}' ${spec_uid} ${spec_gid} -c \"${gecos}\"" .. - "${spec_home} -s ${shell} ${spec_groups} ${home_skel}", - replacements = { - base = base, - username = assert(tab.username), - gecos = tab.gecos or "Unnamed User", - shell = tab.shell or "/bin/sh", - spec_uid = add_flag("-u", tab.uid), - spec_gid = add_flag("-g", tab.group), - spec_home = add_flag("-d", tab.home), - spec_groups = add_flag("-G", tab.groups), - home_skel = home_skel - }, - }) - - if tab.password then - ts:cmds_set_password(cmds, tab.username, tab.password) - end - end - - -- - -- Create commands to copy files and directories to the traget system. - -- - ts.cmds_install_srcs = function(ts, cmds, srclist) - local i, src, dest, spd - - -- - -- Only bother to copy the mountpoint IF: - -- o We have said to copy it at some point - -- (something in srclist is a prefix of it); and - -- o We have not already said to copy it - -- (it is not a prefix of anything in srclist.) - -- - local is_valid_mountpoint = function(root, mountpoint) - local seen_it = false - local i, src - - local starts_with = function(str, prefix) - return string.sub(str, string.len(prefix)) == prefix - end - - for i, src in ipairs(srclist) do - if starts_with(mountpoint, root .. src) then - seen_it = true - end - if starts_with(root .. src, mountpoint) then - return false - end - end - - return seen_it - end - - for i, src in ipairs(srclist) do - -- - -- Create intermediate directories as needed. - -- - cmds:add{ - cmdline = "${root}${MKDIR} -p ${root}${base}${src_dir}", - replacements = { - base = base, - src_dir = FileName.dirname(src) - } - } - - -- - -- If a source by the same name but with the suffix - -- ".hdd" exists on the installation media, cpdup that - -- instead. This is particularly useful with /etc, which - -- may have significantly different behaviour on the - -- live CD compared to a standard HDD boot. - -- - dest = src - if FileName.is_dir(App.dir.root .. src .. ".hdd") or - FileName.is_file(App.dir.root .. src .. ".hdd") then - src = src .. ".hdd" - end - - -- - -- Cpdup the chosen source onto the HDD. - -- - cmds:add({ - cmdline = "${root}${CPDUP} ${root}${src} ${root}${base}${dest}", - replacements = { - base = base, - src = src, - dest = dest - }, - log_mode = CmdChain.LOG_QUIET -- don't spam log - }) - end - - -- - -- Now, because cpdup does not cross mount points, - -- we must copy anything that the user might've made a - -- seperate mount point for (e.g. /usr/libdata/lint.) - -- - for spd in pd:get_subparts() do - -- - -- Only copy files into the subpartition if: - -- o It is a regular (i.e. not swap) subpartition, and - -- o A directory exists on the install medium for it - -- - - -- - -- This assumes that the subpartition descriptors - -- have mountpoints associated with them, which should - -- (nowadays) always be the case. - -- - if spd:get_fstype() == "4.2BSD" and - FileName.is_dir(App.dir.root .. spd:get_mountpoint()) then - if is_valid_mountpoint(App.dir.root, spd:get_mountpoint()) then - -- - -- Cpdup the subpartition. - -- - -- XXX check for .hdd-extended source dirs here, too, - -- eventually - but for now, /etc.hdd will never be - -- the kind of tricky sub-mount-within-a-mount-point - -- that this part of the code is meant to handle. - -- - cmds:add{ - cmdline = "${root}${CPDUP} ${root}${mtpt} " .. - "${root}${base}${mtpt}", - replacements = { - base = base, - mtpt = spd:get_mountpoint() - }, - log_mode = CmdChain.LOG_QUIET - } - end - end - end - end - - -- - -- Create mountpoint directories on a new system, based on what - -- the user wants (the subpartition descriptors under the given - -- partition descriptor) and return a fstab structure describing them. - -- - ts.create = function(ts) - local spd, cmds - - -- - -- Mount the target system's root filesystem, - -- if not already mounted - -- - if not root_is_mounted then - if not mount_root_filesystem() then - return false - end - end - - -- - -- Create mount points for later mounting of subpartitions. - -- - cmds = CmdChain.new() - fstab = {} - for spd in pd:get_subparts() do - local mtpt = spd:get_mountpoint() - local dev = spd:get_device_name() - - cmds:set_replacements{ - base = base, - dev = dev, - mtpt = FileName.remove_leading_slash(mtpt) - } - - if spd:is_swap() then - if App.option.enable_crashdumps and - spd:get_capacity() >= App.state.store:get_ram() then - -- - -- Set this subpartition as the dump device. - -- - cmds:add("${root}${DUMPON} -v ${root}dev/${dev}") - App.state.crash_device = mnt_dev - end - fstab[mtpt] = { - device = "/dev/" .. dev, - fstype = "swap", - options = "sw", - dump = 0, - pass = 0 - } - else - if spd:get_mountpoint() ~= "/" then - cmds:add("${root}${MKDIR} -p ${root}${base}${mtpt}") - end - fstype = "ufs" - opts = "rw" - fstab[mtpt] = { - device = "/dev/" .. dev, - fstype = "ufs", - options = "rw", - dump = 2, - pass = 2 - } - if mtpt == "/" then - fstab[mtpt].dump = 1 - fstab[mtpt].pass = 1 - end - end - end - return cmds:execute() - end - - -- - -- Parse the fstab of a mounted target system. - -- Returns either a table representing the fstab, or - -- nil plus an error message string. - -- - -- As a side effect, this function also associates mountpoints - -- with the subpartition descriptors under the partition - -- descriptor with which this target system is associated. - -- - ts.probe = function(ts) - local fstab_filename, fstab_file, errmsg - local spd - - -- - -- Mount the target system's root filesystem, - -- if not already mounted. - -- - if not root_is_mounted then - if not mount_root_filesystem() then - return nil, "Could not mount / of target system." - end - end - - -- - -- Open the target system's fstab and parse it. - -- - fstab_filename = App.expand("${root}${base}etc/fstab", { - base = base - }) - fstab_file, errmsg = io.open(fstab_filename, "r") - if not fstab_file then - return nil, "Could not open /etc/fstab of target system." - end - - fstab = {} - line = fstab_file:read() - while line do - -- - -- Parse the fstab line. - -- - if string.find(line, "^%s*#") then - -- comment: skip it - elseif string.find(line, "^%s*$") then - -- blank line: skip it - else - local found, len, dev, mtpt, fstype, opts, dump, pass = - string.find(line, "%s*([^%s]*)%s*([^%s]*)%s*" .. - "([^%s]*)%s*([^%s]*)%s*([^%s]*)%s*([^%s]*)") - if not found then - App.log("Warning: malformed line in fstab: " .. - line) - else - fstab[mtpt] = { - device = dev, - fstype = fstype, - options = opts, - dump = dump, - pass = pass - } - spd = pd:get_subpart_by_device_name(dev) - if fstype ~= "ufs" then - -- Don't associate non-ufs - -- fs's with any mountpoint. - elseif not spd then - -- This can happen if e.g. - -- the user has included a - -- subpartition from another - -- drive in their fstab. - else - -- Associate mountpoint. - spd:set_mountpoint(mtpt) - end - end - end - line = fstab_file:read() - end - fstab_file:close() - - return fstab - end - - ts.use_current = function(ts) - using_current = true - base = "/" - return true - end - - -- - -- Mount the system on the given partition into the given mount - -- directory (typically "mnt".) - -- - ts.mount = function(ts) - local cmds, i, mtpt, mtpts, fsdesc - - if using_current or is_mounted then - return true - end - - if not root_is_mounted or fstab == nil then - return false - end - - -- - -- Go through each of the mountpoints in our fstab, - -- and if it looks like we should, try mount it under base. - -- - - mtpts = {} - for mtpt, fsdesc in fstab do - table.insert(mtpts, mtpt) - end - table.sort(mtpts) - - cmds = CmdChain.new() - for i, mtpt in mtpts do - fsdesc = fstab[mtpt] - if mtpt == "/" then - -- It's already been mounted by - -- read_target_fstab() or create_mountpoints. - elseif string.find(fsdesc.options, "noauto") then - -- It's optional. Don't mount it. - elseif (not string.find(fsdesc.device, "^/dev/") and - fsdesc.device ~= "swap") then - -- Device doesn't start with /dev/ and - -- it isn't 'swap'. Don't even go near it. - elseif mtpt == "none" or fsdesc.fstype == "swap" then - -- Swap partition. Don't mount it. - elseif fsdesc.device == "swap" then - -- It's swap-backed. mount_mfs it. - - cmds:add({ - cmdline = "${root}${MOUNT_MFS} ${swap_opts} swap ${root}${base}${mtpt}", - replacements = { - swap_opts = convert_swap_options(fsdesc.options), - base = base, - mtpt = FileName.remove_leading_slash(mtpt) - } - }) - else - -- If we got here, it must be normal and valid. - cmds:set_replacements{ - dev = FileName.basename(fsdesc.device), - opts = fsdesc.options, -- XXX this may need further cleaning? - base = base, - mtpt = FileName.remove_leading_slash(mtpt) - } - cmds:add( - "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - "${root}${MOUNT} -o ${opts} ${root}dev/${dev} ${root}${base}${mtpt}" - ) - end - end - - is_mounted = cmds:execute() - return is_mounted - end - - -- - -- Unmount the target system. - -- - ts.unmount = function(ts) - if using_current or - (not is_mounted and not root_is_mounted) then - return true - end - local cmds = CmdChain.new() - unmount_all_under(cmds) - if cmds:execute() then - is_mounted = false - root_is_mounted = false - return true - else - return false - end - end - - -- - -- 'Constructor' - initialize instance state. - -- - - -- - -- Fix up base. - -- - base = base or "" - base = FileName.add_trailing_slash(base) - - return ts -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Menu.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Menu.lua deleted file mode 100644 index 31b8b3e25e..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Menu.lua +++ /dev/null @@ -1,178 +0,0 @@ --- lib/menu.lua --- $Id: Menu.lua,v 1.8 2005/03/29 21:04:19 cpressey Exp $ - --- BEGIN lib/menu.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - ---[[----------]]-- ---[[ MenuItem ]]-- ---[[----------]]-- - --- Global "class" variable. -MenuItem = {} - --- Global (but private) data and functions. -local next_id = 0 -- next unique id to create -local new_id = function() -- Create a new unique identifier. - next_id = next_id + 1 - return tostring(next_id) -end - --- Constructor. -MenuItem.new = function(tab) - local method = {} - local id = tab.id or "menu_action_" .. new_id() - local name = tab.name or "" - local short_desc = tab.short_desc - local long_desc = tab.long_desc - local effect = tab.effect - - method.to_action = function(item) - return { - id = id, - name = name, - short_desc = short_desc, - long_desc = long_desc, - effect = effect - } - end - - return method -end - ---[[------]]-- ---[[ Menu ]]-- ---[[------]]-- - --- Global "class" variable: -Menu = {} - --- Global (and public) symbolic constants: -Menu.CONTINUE = {} -Menu.DONE = {} - --- Global (but private) state variables in the class: -local menu_stack = {} -- stack of the most recently displayed menus -local make_exit_item = function() - local exit_item_name = "Exit" - - if table.getn(menu_stack) > 0 then - exit_item_name = "Return to " .. - menu_stack[table.getn(menu_stack)]:get_name() - end - - return { - name = exit_item_name, - effect = function() - return Menu.DONE - end - } -end - --- Create a new menu object instance. -Menu.new = function(opt) - local method = {} - local item = {} - local menu_id = opt.menu_id or "menu_form_" .. new_id() - local ui = opt.ui or App.ui - local name = opt.name or "" - local exit_item = opt.exit_item or make_exit_item() - local continue_constraint = opt.continue_constraint - - -- Private functions. - local map_items_to_actions = function(item) - local k, v - local action = {} - - for k, v in item do - action[k] = item[k]:to_action() - end - - return action - end - - -- Methods. - method.add_item = function(menu, tab) - -- XXX: if tab is already a MenuItem object, - -- just add it, else: - table.insert(item, MenuItem.new(tab)) - end - - method.get_name = function(menu) - return name - end - - -- - -- Populate this menu with items derived from the Lua script files - -- in the given directory. Each script should end with a return - -- statement that returns a table describing the menu item. - -- - method.from_dir = function(menu, dir) - local i, filename, filenames - - filenames = POSIX.dir(dir) - table.sort(filenames) - - for i, filename in filenames do - local full_file = dir .. "/" .. filename - - if filename ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(filename, "^[^%.].*%.lua$") then - local tab = App.run_script(full_file) - if tab then - menu:add_item(tab) - end - end - end - - menu:add_item(exit_item) - - return menu - end - - -- - -- Present this menu to the user. - -- - method.present = function(menu) - table.insert(menu_stack, menu) - local response = ui:present({ - id = menu_id, - name = opt.name, - short_desc = opt.short_desc, - long_desc = opt.long_desc, - role = "menu", - actions = map_items_to_actions(item) - }) - table.remove(menu_stack) - return response - end - - method.loop = function(menu) - local result = Menu.CONTINUE - - while result == Menu.CONTINUE do - result = menu:present().result - if continue_constraint then - result = continue_constraint(result) - end - end - end - - return method -end - --- Create a new menu object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -Menu.auto = function(opt) - local menu = Menu.new(opt) - - menu:from_dir(FileName.dirname(App.current_script)) - menu:loop() -end - --- END of lib/menu.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/MenuItem.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/MenuItem.lua deleted file mode 100644 index 66f9eba60d..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/MenuItem.lua +++ /dev/null @@ -1,178 +0,0 @@ --- lib/menu.lua --- $Id: MenuItem.lua,v 1.8 2005/03/29 21:04:19 cpressey Exp $ - --- BEGIN lib/menu.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - ---[[----------]]-- ---[[ MenuItem ]]-- ---[[----------]]-- - --- Global "class" variable. -MenuItem = {} - --- Global (but private) data and functions. -local next_id = 0 -- next unique id to create -local new_id = function() -- Create a new unique identifier. - next_id = next_id + 1 - return tostring(next_id) -end - --- Constructor. -MenuItem.new = function(tab) - local method = {} - local id = tab.id or "menu_action_" .. new_id() - local name = tab.name or "" - local short_desc = tab.short_desc - local long_desc = tab.long_desc - local effect = tab.effect - - method.to_action = function(item) - return { - id = id, - name = name, - short_desc = short_desc, - long_desc = long_desc, - effect = effect - } - end - - return method -end - ---[[------]]-- ---[[ Menu ]]-- ---[[------]]-- - --- Global "class" variable: -Menu = {} - --- Global (and public) symbolic constants: -Menu.CONTINUE = {} -Menu.DONE = {} - --- Global (but private) state variables in the class: -local menu_stack = {} -- stack of the most recently displayed menus -local make_exit_item = function() - local exit_item_name = "Exit" - - if table.getn(menu_stack) > 0 then - exit_item_name = "Return to " .. - menu_stack[table.getn(menu_stack)]:get_name() - end - - return { - name = exit_item_name, - effect = function() - return Menu.DONE - end - } -end - --- Create a new menu object instance. -Menu.new = function(opt) - local method = {} - local item = {} - local menu_id = opt.menu_id or "menu_form_" .. new_id() - local ui = opt.ui or App.ui - local name = opt.name or "" - local exit_item = opt.exit_item or make_exit_item() - local continue_constraint = opt.continue_constraint - - -- Private functions. - local map_items_to_actions = function(item) - local k, v - local action = {} - - for k, v in item do - action[k] = item[k]:to_action() - end - - return action - end - - -- Methods. - method.add_item = function(menu, tab) - -- XXX: if tab is already a MenuItem object, - -- just add it, else: - table.insert(item, MenuItem.new(tab)) - end - - method.get_name = function(menu) - return name - end - - -- - -- Populate this menu with items derived from the Lua script files - -- in the given directory. Each script should end with a return - -- statement that returns a table describing the menu item. - -- - method.from_dir = function(menu, dir) - local i, filename, filenames - - filenames = POSIX.dir(dir) - table.sort(filenames) - - for i, filename in filenames do - local full_file = dir .. "/" .. filename - - if filename ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(filename, "^[^%.].*%.lua$") then - local tab = App.run_script(full_file) - if tab then - menu:add_item(tab) - end - end - end - - menu:add_item(exit_item) - - return menu - end - - -- - -- Present this menu to the user. - -- - method.present = function(menu) - table.insert(menu_stack, menu) - local response = ui:present({ - id = menu_id, - name = opt.name, - short_desc = opt.short_desc, - long_desc = opt.long_desc, - role = "menu", - actions = map_items_to_actions(item) - }) - table.remove(menu_stack) - return response - end - - method.loop = function(menu) - local result = Menu.CONTINUE - - while result == Menu.CONTINUE do - result = menu:present().result - if continue_constraint then - result = continue_constraint(result) - end - end - end - - return method -end - --- Create a new menu object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -Menu.auto = function(opt) - local menu = Menu.new(opt) - - menu:from_dir(FileName.dirname(App.current_script)) - menu:loop() -end - --- END of lib/menu.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Network.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Network.lua deleted file mode 100644 index 5bb36368d4..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Network.lua +++ /dev/null @@ -1,391 +0,0 @@ --- lib/network.lua --- $Id: Network.lua,v 1.10 2005/03/27 01:19:41 cpressey Exp $ --- Lua abstraction for the Network Interfaces of a system. - --- BEGIN lib/network.lua -- - -require "app" -require "cmdchain" - ---[[------------------]]-- ---[[ NetworkInterface ]]-- ---[[------------------]]-- - --- --- This class returns an object which represents one of the system's --- network interfaces. --- --- This class is not typically instantiated directly by client code. --- Instead, the user should call NetworkInterface.all() to get a table --- of all network interfaces present in the system, and choose one. --- -NetworkInterface = {} -NetworkInterface.new = function(name) - local ni = {} -- instance variable - local desc = name -- description of device - local up -- internal state... - local mtu - local inet6, prefixlen, scopeid - local inet, netmask, broadcast - local ether - - local toboolean = function(x) - if x then - return true - else - return false - end - end - - -- - -- Probe this network interface for its current state. - -- - -- dc0: flags=8843 mtu 1500 - -- inet6 fe80::250:bfff:fe96:cf68%dc0 prefixlen 64 scopeid 0x1 - -- inet 10.0.0.19 netmask 0xffffff00 broadcast 10.0.0.255 - -- ether 00:50:bf:96:cf:68 - -- media: Ethernet autoselect (10baseT/UTP) - -- - ni.probe = function(ni) - local found, len, cap, flagstring - local pty - - up = nil - mtu = nil - inet6, prefixlen, scopeid = nil, nil, nil - inet, netmask, broadcast = nil, nil, nil - - pty = Pty.open(App.expand("${root}${IFCONFIG} ${name}", { name = name })) - if not pty then - return nil, "could not open pty" - end - line = pty:readline() - while line do - found, len, cap, flagstring = - string.find(line, "flags%s*=%s*(%d+)%s*%<([^%>]*)%>") - if found then - flagstring = "," .. flagstring .. "," - up = toboolean(string.find(flagstring, ",UP,")) - end - - found, len, cap = string.find(line, "mtu%s*(%d+)") - if found then - mtu = tonumber(cap) - end - found, len, cap = string.find(line, "inet6%s*([^%s]+)") - if found then - inet6 = cap - end - found, len, cap = string.find(line, "prefixlen%s*(%d+)") - if found then - prefixlen = tonumber(cap) - end - found, len, cap = string.find(line, "scopeid%s*0x(%x+)") - if found then - scopeid = cap - end - found, len, cap = string.find(line, "inet%s*(%d+%.%d+%.%d+%.%d+)") - if found then - inet = cap - end - found, len, cap = string.find(line, "netmask%s*0x(%x+)") - if found then - netmask = cap - end - found, len, cap = string.find(line, "broadcast%s*(%d+%.%d+%.%d+%.%d+)") - if found then - broadcast = cap - end - found, len, cap = string.find(line, "ether%s*(%x%x%:%x%x%:%x%x%:%x%x%:%x%x%:%x%x%)") - if found then - ether = cap - end - line = pty:readline() - end - pty:close() - end - - -- - -- Accessor methods. - -- - - ni.is_up = function(ni) - return up - end - - ni.get_name = function(ni) - return name - end - - ni.get_inet_addr = function(ni) - return inet - end - - ni.get_netmask = function(ni) - return netmask - end - - ni.get_broadcast_addr = function(ni) - return broadcast - end - - ni.get_ether_addr = function(ni) - return ether - end - - ni.get_desc = function(ni) - return desc - end - - ni.set_desc = function(ni, new_desc) - -- - -- Calculate a score for how well this string describes - -- a network interface. Reject obviously bogus descriptions - -- (usually harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%<.*%>") then - score = score + 10 - end - - -- Look for irrelevancies - if string.find(s, "MII bus") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - -- - -- Set the description of a device, as best we can, based on - -- the available system information. - -- - ni.auto_describe = function(ni) - -- - -- First give some common pseudo-devices some - -- reasonable 'canned' descriptions. - -- - local descs = { - ["ppp%d+"] = "Point-to-Point Protocol device", - ["sl%d+"] = "Serial Line IP device", - ["faith%d+"] = "IPv6-to-IPv4 Tunnel device", - ["lp%d+"] = "Network Line Printer device", - ["lo%d+"] = "Loopback device" - } - for pat, desc in descs do - if string.find(name, "^" .. pat .. "$") then - ni:set_desc(name .. ": " .. desc) - end - end - - -- - -- Now look through dmesg.boot for the names of - -- physical network interface hardware. - -- - for line in io.lines("/var/run/dmesg.boot") do - local found, len, cap = - string.find(line, "^" .. name .. ":.*(%<.*%>).*$") - if found then - ni:set_desc(name .. ": " .. cap) - end - end - end - - -- - -- CmdChain-creating methods. - -- - - ni.cmds_assign_inet_addr = function(ni, cmds, addr) - cmds:add({ - cmdline = "${root}${IFCONFIG} ${name} ${addr}", - replacements = { - name = name, - addr = addr - } - }) - end - - ni.cmds_assign_netmask = function(ni, cmds, netmask) - cmds:add({ - cmdline = "${root}${IFCONFIG} ${name} netmask ${netmask}", - replacements = { - name = name, - netmask = netmask - } - }) - end - - ni.cmds_dhcp_configure = function(ni, cmds) - cmds:add( - { - cmdline = "${root}${KILLALL} dhclient", - failure_mode = CmdChain.FAILURE_IGNORE - }, - { - cmdline = "${root}${DHCLIENT} -1 ${name}", - replacements = { - name = name - } - } - ) - end - - return ni -end - ---[[-------------------]]-- ---[[ NetworkInterfaces ]]-- ---[[-------------------]]-- - --- --- A container/aggregate class. Contains a bunch of NetworkInterface --- objects, typically the set of those available on a given system. --- - -NetworkInterfaces = {} - -NetworkInterfaces.new = function() - local ni_tab = {} - local method = {} - - method.add = function(nis) - ni_tab[ni.name] = ni - end - - method.get = function(nis, name) - return ni_tab[name] - end - - -- Iterator, typically used in for loops. - method.each = function(nis) - local name, ni - local list = {} - local i, n = 0, 0 - - for name, ni in ni_tab do - table.insert(list, ni) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- - -- Populate the NetworkInterface collection with all the - -- network interfaces detected as present in the system. - -- - method.probe = function(nis) - local pty, line, name, ni, line, pat, desc - - pty = Pty.open(App.expand("${root}${IFCONFIG} -l")) - if not pty then - return nil, "could not open pty" - end - line = pty:readline() - pty:close() - - ni_tab = {} - - for name in string.gfind(line, "%s*([^%s]+)%s*") do - ni = NetworkInterface.new(name) - ni:probe() - ni:auto_describe() - ni_tab[name] = ni - end - - return nis - end - - -- - -- Returns the number of configured IP addresses of all the - -- NetworkInterface objects in this NetworkInterfaces object. - -- - -- Practically, used for asking "Uh, is the network on?" :) - -- - method.ip_addr_count = function(nis) - local name, ni - local num = 0 - - for name, ni in ni_tab do - ip_addr = ni:get_inet_addr() - if ip_addr and not string.find(ip_addr, "^127%..*$") then - num = num + 1 - end - end - - return num - end - - -- - -- User-interface methods. - -- - - -- - -- Display a dialog box, allow the user to select which - -- network interface they want to use. - -- - method.ui_select_interface = function(nis, tab) - local actions, ni, ifname - if not tab then tab = {} end - local ui = tab.ui or App.ui - local id = tab.id or "select_interface" - local name = tab.name or _("Select Network Interface") - local short_desc = tab.short_desc or _( - "Please select the network interface you wish to configure." - ) - - -- - -- Get interface list. - -- - actions = {} - for ni in nis:each() do - table.insert(actions, { - id = ni:get_name(), - name = ni:get_desc() - }) - end - table.insert(actions, { - id = "cancel", - name = "Cancel" - }) - - ifname = App.ui:present({ - id = id, - name = name, - short_desc = short_desc, - role = "menu", - actions = actions - }).action_id - - if ifname == "cancel" then - return nil - else - return nis:get(ifname) - end - end - - return method -end - --- END of lib/network.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Package.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Package.lua deleted file mode 100644 index 36624779ca..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Package.lua +++ /dev/null @@ -1,224 +0,0 @@ --- lib/package.lua --- $Id: Package.lua,v 1.13 2005/04/04 18:59:20 cpressey Exp $ --- Installer package functions written in Lua. - --- BEGIN lib/package.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - -require "cmdchain" - ---[[---------]]-- ---[[ Package ]]-- ---[[---------]]-- - --- This 'class' currently only contains static global methods --- for dealing with packages. There is no 'package object.' - -Package = {} - --- --- Determine whether a package is installed on a HDD. --- -Package.exists = function(base, pkg_name) - return FileName.is_dir( - App.expand("${root}${base}var/db/pkg/${pkg_name}", { - base = base, - pkg_name = pkg_name - }) - ) -end - -Package.list_all = function(base) - local i, filename, list - local dir = POSIX.dir( - App.expand("${root}${base}var/db/pkg", { - base = base - }) - ) - - list = {} - for i, filename in ipairs(dir) do - if filename ~= "." and filename ~= ".." then - table.insert(list, filename) - end - end - - return list -end - --- --- Methods which construct command-chains. --- - --- --- Delete all packages from a given base. --- -Package.cmds_clean = function(base, cmds) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} '*'", - replacements = { base = base } - }) -end - --- --- Create commands to copy a package from the installation media onto --- the target system. --- --- This function returns the number of packages that will be copied --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_copy = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, rpkg_name, line, pkg_suffix - local depcount = 0 - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively copy them first, if they're not already there, - -- and if we've not already seen them. - -- - -- It woulld be nice if we could send this command through a command - -- chain so that we could get an accurate idea of what is being - -- run and so that it will be logged. But unfortunately that's - -- not feasible, since this function is building another command - -- chain for later use. So we use a pty. - -- - pty = Pty.open(App.expand("${root}${PKG_INFO} -r ") .. pkg_name) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that begin with 'Dependency:'. - -- - local found, len, rpkg_name = - string.find(line, "^Dependency:%s*([^%s]+)") - if found and not Package.exists(base, rpkg_name) then - local subcount = Package.cmds_copy( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - line = pty:readline() - end - pty:close() - - pkg_suffix = "tgz" - if App.os.name == "FreeBSD" then - pkg_suffix = "tbz" - end - - if not Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:set_replacements{ - base = base, - pkg_name = pkg_name, - pkg_suffix = pkg_suffix - } - cmds:add( - "${root}${PKG_CREATE} -b ${pkg_name} ${root}${base}tmp/${pkg_name}.${pkg_suffix}", - { - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PKG_ADD} /tmp/${pkg_name}.${pkg_suffix}", - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }, - "${root}${RM} ${root}${base}tmp/${pkg_name}.${pkg_suffix}" - ) - end - - return depcount -end - --- --- Remove a package from a target system. --- --- This function returns the number of packages that will be removed --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_remove = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, line - local command, rpkg_name - local depcount = 0 - local seen_required_by = false - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively delete them. - -- - pty = Pty.open(App.expand( - "${root}${CHROOT} ${root}${base} /${PKG_INFO} -R ${pkg_name}", { - base = base, - pkg_name = pkg_name - } - )) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that follow the "Required by:" line. - -- - if seen_required_by then - found, len, rpkg_name = - string.find(line, "^%s*([^%s]+)") - if found and Package.exists(base, rpkg_name) then - local subcount = Package.cmds_remove( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - else - if string.find(line, "^Required by:") then - seen_required_by = true - end - end - line = pty:readline() - end - pty:close() - - if Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} ${pkg_name}", - replacements = { - base = base, - pkg_name = pkg_name - }, - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }) - end - - return depcount -end - --- END of lib/package.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageGraph.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageGraph.lua deleted file mode 100644 index 36f9df1b5f..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageGraph.lua +++ /dev/null @@ -1,224 +0,0 @@ --- lib/package.lua --- $Id: PackageGraph.lua,v 1.13 2005/04/04 18:59:20 cpressey Exp $ --- Installer package functions written in Lua. - --- BEGIN lib/package.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - -require "cmdchain" - ---[[---------]]-- ---[[ Package ]]-- ---[[---------]]-- - --- This 'class' currently only contains static global methods --- for dealing with packages. There is no 'package object.' - -Package = {} - --- --- Determine whether a package is installed on a HDD. --- -Package.exists = function(base, pkg_name) - return FileName.is_dir( - App.expand("${root}${base}var/db/pkg/${pkg_name}", { - base = base, - pkg_name = pkg_name - }) - ) -end - -Package.list_all = function(base) - local i, filename, list - local dir = POSIX.dir( - App.expand("${root}${base}var/db/pkg", { - base = base - }) - ) - - list = {} - for i, filename in ipairs(dir) do - if filename ~= "." and filename ~= ".." then - table.insert(list, filename) - end - end - - return list -end - --- --- Methods which construct command-chains. --- - --- --- Delete all packages from a given base. --- -Package.cmds_clean = function(base, cmds) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} '*'", - replacements = { base = base } - }) -end - --- --- Create commands to copy a package from the installation media onto --- the target system. --- --- This function returns the number of packages that will be copied --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_copy = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, rpkg_name, line, pkg_suffix - local depcount = 0 - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively copy them first, if they're not already there, - -- and if we've not already seen them. - -- - -- It woulld be nice if we could send this command through a command - -- chain so that we could get an accurate idea of what is being - -- run and so that it will be logged. But unfortunately that's - -- not feasible, since this function is building another command - -- chain for later use. So we use a pty. - -- - pty = Pty.open(App.expand("${root}${PKG_INFO} -r ") .. pkg_name) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that begin with 'Dependency:'. - -- - local found, len, rpkg_name = - string.find(line, "^Dependency:%s*([^%s]+)") - if found and not Package.exists(base, rpkg_name) then - local subcount = Package.cmds_copy( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - line = pty:readline() - end - pty:close() - - pkg_suffix = "tgz" - if App.os.name == "FreeBSD" then - pkg_suffix = "tbz" - end - - if not Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:set_replacements{ - base = base, - pkg_name = pkg_name, - pkg_suffix = pkg_suffix - } - cmds:add( - "${root}${PKG_CREATE} -b ${pkg_name} ${root}${base}tmp/${pkg_name}.${pkg_suffix}", - { - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PKG_ADD} /tmp/${pkg_name}.${pkg_suffix}", - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }, - "${root}${RM} ${root}${base}tmp/${pkg_name}.${pkg_suffix}" - ) - end - - return depcount -end - --- --- Remove a package from a target system. --- --- This function returns the number of packages that will be removed --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_remove = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, line - local command, rpkg_name - local depcount = 0 - local seen_required_by = false - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively delete them. - -- - pty = Pty.open(App.expand( - "${root}${CHROOT} ${root}${base} /${PKG_INFO} -R ${pkg_name}", { - base = base, - pkg_name = pkg_name - } - )) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that follow the "Required by:" line. - -- - if seen_required_by then - found, len, rpkg_name = - string.find(line, "^%s*([^%s]+)") - if found and Package.exists(base, rpkg_name) then - local subcount = Package.cmds_remove( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - else - if string.find(line, "^Required by:") then - seen_required_by = true - end - end - line = pty:readline() - end - pty:close() - - if Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} ${pkg_name}", - replacements = { - base = base, - pkg_name = pkg_name - }, - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }) - end - - return depcount -end - --- END of lib/package.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageList.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageList.lua deleted file mode 100644 index 0b6a1df77f..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageList.lua +++ /dev/null @@ -1,224 +0,0 @@ --- lib/package.lua --- $Id: PackageList.lua,v 1.13 2005/04/04 18:59:20 cpressey Exp $ --- Installer package functions written in Lua. - --- BEGIN lib/package.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - -require "cmdchain" - ---[[---------]]-- ---[[ Package ]]-- ---[[---------]]-- - --- This 'class' currently only contains static global methods --- for dealing with packages. There is no 'package object.' - -Package = {} - --- --- Determine whether a package is installed on a HDD. --- -Package.exists = function(base, pkg_name) - return FileName.is_dir( - App.expand("${root}${base}var/db/pkg/${pkg_name}", { - base = base, - pkg_name = pkg_name - }) - ) -end - -Package.list_all = function(base) - local i, filename, list - local dir = POSIX.dir( - App.expand("${root}${base}var/db/pkg", { - base = base - }) - ) - - list = {} - for i, filename in ipairs(dir) do - if filename ~= "." and filename ~= ".." then - table.insert(list, filename) - end - end - - return list -end - --- --- Methods which construct command-chains. --- - --- --- Delete all packages from a given base. --- -Package.cmds_clean = function(base, cmds) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} '*'", - replacements = { base = base } - }) -end - --- --- Create commands to copy a package from the installation media onto --- the target system. --- --- This function returns the number of packages that will be copied --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_copy = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, rpkg_name, line, pkg_suffix - local depcount = 0 - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively copy them first, if they're not already there, - -- and if we've not already seen them. - -- - -- It woulld be nice if we could send this command through a command - -- chain so that we could get an accurate idea of what is being - -- run and so that it will be logged. But unfortunately that's - -- not feasible, since this function is building another command - -- chain for later use. So we use a pty. - -- - pty = Pty.open(App.expand("${root}${PKG_INFO} -r ") .. pkg_name) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that begin with 'Dependency:'. - -- - local found, len, rpkg_name = - string.find(line, "^Dependency:%s*([^%s]+)") - if found and not Package.exists(base, rpkg_name) then - local subcount = Package.cmds_copy( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - line = pty:readline() - end - pty:close() - - pkg_suffix = "tgz" - if App.os.name == "FreeBSD" then - pkg_suffix = "tbz" - end - - if not Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:set_replacements{ - base = base, - pkg_name = pkg_name, - pkg_suffix = pkg_suffix - } - cmds:add( - "${root}${PKG_CREATE} -b ${pkg_name} ${root}${base}tmp/${pkg_name}.${pkg_suffix}", - { - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PKG_ADD} /tmp/${pkg_name}.${pkg_suffix}", - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }, - "${root}${RM} ${root}${base}tmp/${pkg_name}.${pkg_suffix}" - ) - end - - return depcount -end - --- --- Remove a package from a target system. --- --- This function returns the number of packages that will be removed --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_remove = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, line - local command, rpkg_name - local depcount = 0 - local seen_required_by = false - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively delete them. - -- - pty = Pty.open(App.expand( - "${root}${CHROOT} ${root}${base} /${PKG_INFO} -R ${pkg_name}", { - base = base, - pkg_name = pkg_name - } - )) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that follow the "Required by:" line. - -- - if seen_required_by then - found, len, rpkg_name = - string.find(line, "^%s*([^%s]+)") - if found and Package.exists(base, rpkg_name) then - local subcount = Package.cmds_remove( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - else - if string.find(line, "^Required by:") then - seen_required_by = true - end - end - line = pty:readline() - end - pty:close() - - if Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} ${pkg_name}", - replacements = { - base = base, - pkg_name = pkg_name - }, - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }) - end - - return depcount -end - --- END of lib/package.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageSet.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageSet.lua deleted file mode 100644 index 26e104334b..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/PackageSet.lua +++ /dev/null @@ -1,224 +0,0 @@ --- lib/package.lua --- $Id: PackageSet.lua,v 1.13 2005/04/04 18:59:20 cpressey Exp $ --- Installer package functions written in Lua. - --- BEGIN lib/package.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - -require "cmdchain" - ---[[---------]]-- ---[[ Package ]]-- ---[[---------]]-- - --- This 'class' currently only contains static global methods --- for dealing with packages. There is no 'package object.' - -Package = {} - --- --- Determine whether a package is installed on a HDD. --- -Package.exists = function(base, pkg_name) - return FileName.is_dir( - App.expand("${root}${base}var/db/pkg/${pkg_name}", { - base = base, - pkg_name = pkg_name - }) - ) -end - -Package.list_all = function(base) - local i, filename, list - local dir = POSIX.dir( - App.expand("${root}${base}var/db/pkg", { - base = base - }) - ) - - list = {} - for i, filename in ipairs(dir) do - if filename ~= "." and filename ~= ".." then - table.insert(list, filename) - end - end - - return list -end - --- --- Methods which construct command-chains. --- - --- --- Delete all packages from a given base. --- -Package.cmds_clean = function(base, cmds) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} '*'", - replacements = { base = base } - }) -end - --- --- Create commands to copy a package from the installation media onto --- the target system. --- --- This function returns the number of packages that will be copied --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_copy = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, rpkg_name, line, pkg_suffix - local depcount = 0 - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively copy them first, if they're not already there, - -- and if we've not already seen them. - -- - -- It woulld be nice if we could send this command through a command - -- chain so that we could get an accurate idea of what is being - -- run and so that it will be logged. But unfortunately that's - -- not feasible, since this function is building another command - -- chain for later use. So we use a pty. - -- - pty = Pty.open(App.expand("${root}${PKG_INFO} -r ") .. pkg_name) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that begin with 'Dependency:'. - -- - local found, len, rpkg_name = - string.find(line, "^Dependency:%s*([^%s]+)") - if found and not Package.exists(base, rpkg_name) then - local subcount = Package.cmds_copy( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - line = pty:readline() - end - pty:close() - - pkg_suffix = "tgz" - if App.os.name == "FreeBSD" then - pkg_suffix = "tbz" - end - - if not Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:set_replacements{ - base = base, - pkg_name = pkg_name, - pkg_suffix = pkg_suffix - } - cmds:add( - "${root}${PKG_CREATE} -b ${pkg_name} ${root}${base}tmp/${pkg_name}.${pkg_suffix}", - { - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PKG_ADD} /tmp/${pkg_name}.${pkg_suffix}", - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }, - "${root}${RM} ${root}${base}tmp/${pkg_name}.${pkg_suffix}" - ) - end - - return depcount -end - --- --- Remove a package from a target system. --- --- This function returns the number of packages that will be removed --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_remove = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, line - local command, rpkg_name - local depcount = 0 - local seen_required_by = false - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively delete them. - -- - pty = Pty.open(App.expand( - "${root}${CHROOT} ${root}${base} /${PKG_INFO} -R ${pkg_name}", { - base = base, - pkg_name = pkg_name - } - )) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that follow the "Required by:" line. - -- - if seen_required_by then - found, len, rpkg_name = - string.find(line, "^%s*([^%s]+)") - if found and Package.exists(base, rpkg_name) then - local subcount = Package.cmds_remove( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - else - if string.find(line, "^Required by:") then - seen_required_by = true - end - end - line = pty:readline() - end - pty:close() - - if Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} ${pkg_name}", - replacements = { - base = base, - pkg_name = pkg_name - }, - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }) - end - - return depcount -end - --- END of lib/package.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Partition.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Partition.lua deleted file mode 100644 index cde6f6ad72..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Partition.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: Partition.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystem.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystem.lua deleted file mode 100644 index fbc566bdbd..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystem.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: StorageSystem.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystemUI.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystemUI.lua deleted file mode 100644 index a4935c8549..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageSystemUI.lua +++ /dev/null @@ -1,182 +0,0 @@ --- $Id: StorageSystemUI.lua,v 1.6 2005/04/04 20:50:59 cpressey Exp $ - -require "gettext" - ---[[-----------]]-- ---[[ StorageUI ]]-- ---[[-----------]]-- - -StorageUI = {} - --- Function to present a form to the user from which they --- can select any disk present in the given StorageDescriptor. - -StorageUI.select_disk = function(tab) - local dd - local disk_actions = {} - - local sd = tab.sd or error("Need a storage descriptor") - - local add_disk_action = function(tdd) - table.insert(disk_actions, - { - id = tdd:get_name(), - name = tdd:get_desc(), - effect = function() - return tdd - end - } - ) - end - - for dd in sd:get_disks() do - add_disk_action(dd) - end - - table.insert(disk_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_disk", - name = tab.name or _("Select a Disk"), - short_desc = tab.short_desc or _("Select a disk."), - long_desc = tab.long_desc, - actions = disk_actions, - role = "menu" - }).result -end - --- Function to present a form to the user from which they --- can select any partition present in the given DiskDescriptor. - -StorageUI.select_part = function(tab) - local pd - local part_actions = {} - - local dd = tab.dd or error("Need a disk descriptor") - - local add_part_action = function(tpd) - table.insert(part_actions, - { - id = tostring(tpd:get_number()), - name = tpd:get_desc(), - effect = function() - return tpd - end - } - ) - end - - for pd in dd:get_parts() do - add_part_action(pd) - end - - table.insert(part_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_part", - name = tab.name or _("Select a Partition"), - short_desc = tab.short_desc or _("Select a partition."), - long_desc = tab.long_desc, - actions = part_actions, - role = "menu" - }).result -end - -StorageUI.select_packages = function(tab) - local datasets_list = {} - local pkg, selected, i, dataset - - if not tab.sel_pkgs then - tab.sel_pkgs = {} - end - for pkg, selected in tab.sel_pkgs do - table.insert(datasets_list, { - selected = (selected and "Y") or "N", - package = pkg - }) - end - table.sort(datasets_list, function(a, b) - return a.package < b.package - end) - - local fields_list = { - { - id = "selected", - name = tab.checkbox_name or _("Install?"), - control = "checkbox" - }, - { - id = "package", - name = _("Full Name of Package"), - editable = "false" - } - } - - local actions_list = { - { - id = "all", - name = tab.all_name or _("Select All") - }, - { - id = "none", - name = tab.none_name or _("Select None") - }, - { - id = "ok", - name = tab.ok_name or _("Accept these Packages") - }, - { - id = "cancel", - name = tab.cancel_name or _("Cancel") - } - } - - while true do - local response = App.ui:present({ - id = tab.id or "select_packages", - name = tab.name or _("Select Packages"), - short_desc = tab.short_desc or - _("Select the packages you wish to install."), - long_desc = tab.long_desc, - actions = actions_list, - fields = fields_list, - datasets = datasets_list, - - multiple = "true" - }) - - datasets_list = response.datasets - - if response.action_id == "all" then - for i, dataset in datasets_list do - dataset.selected = "Y" - end - elseif response.action_id == "none" then - for i, dataset in datasets_list do - dataset.selected = "N" - end - else - local pkg_selected = {} - for i, dataset in datasets_list do - pkg_selected[dataset.package] = (dataset.selected == "Y") - end - return response.action_id == "ok", pkg_selected - end - end -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageUI.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageUI.lua deleted file mode 100644 index 765cbb80a5..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/StorageUI.lua +++ /dev/null @@ -1,182 +0,0 @@ --- $Id: StorageUI.lua,v 1.6 2005/04/04 20:50:59 cpressey Exp $ - -require "gettext" - ---[[-----------]]-- ---[[ StorageUI ]]-- ---[[-----------]]-- - -StorageUI = {} - --- Function to present a form to the user from which they --- can select any disk present in the given StorageDescriptor. - -StorageUI.select_disk = function(tab) - local dd - local disk_actions = {} - - local sd = tab.sd or error("Need a storage descriptor") - - local add_disk_action = function(tdd) - table.insert(disk_actions, - { - id = tdd:get_name(), - name = tdd:get_desc(), - effect = function() - return tdd - end - } - ) - end - - for dd in sd:get_disks() do - add_disk_action(dd) - end - - table.insert(disk_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_disk", - name = tab.name or _("Select a Disk"), - short_desc = tab.short_desc or _("Select a disk."), - long_desc = tab.long_desc, - actions = disk_actions, - role = "menu" - }).result -end - --- Function to present a form to the user from which they --- can select any partition present in the given DiskDescriptor. - -StorageUI.select_part = function(tab) - local pd - local part_actions = {} - - local dd = tab.dd or error("Need a disk descriptor") - - local add_part_action = function(tpd) - table.insert(part_actions, - { - id = tostring(tpd:get_number()), - name = tpd:get_desc(), - effect = function() - return tpd - end - } - ) - end - - for pd in dd:get_parts() do - add_part_action(pd) - end - - table.insert(part_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_part", - name = tab.name or _("Select a Partition"), - short_desc = tab.short_desc or _("Select a partition."), - long_desc = tab.long_desc, - actions = part_actions, - role = "menu" - }).result -end - -StorageUI.select_packages = function(tab) - local datasets_list = {} - local pkg, selected, i, dataset - - if not tab.sel_pkgs then - tab.sel_pkgs = {} - end - for pkg, selected in tab.sel_pkgs do - table.insert(datasets_list, { - selected = (selected and "Y") or "N", - package = pkg - }) - end - table.sort(datasets_list, function(a, b) - return a.package < b.package - end) - - local fields_list = { - { - id = "selected", - name = tab.checkbox_name or _("Install?"), - control = "checkbox" - }, - { - id = "package", - name = _("Full Name of Package"), - editable = "false" - } - } - - local actions_list = { - { - id = "all", - name = tab.all_name or _("Select All") - }, - { - id = "none", - name = tab.none_name or _("Select None") - }, - { - id = "ok", - name = tab.ok_name or _("Accept these Packages") - }, - { - id = "cancel", - name = tab.cancel_name or _("Cancel") - } - } - - while true do - local response = App.ui:present({ - id = tab.id or "select_packages", - name = tab.name or _("Select Packages"), - short_desc = tab.short_desc or - _("Select the packages you wish to install."), - long_desc = tab.long_desc, - actions = actions_list, - fields = fields_list, - datasets = datasets_list, - - multiple = "true" - }) - - datasets_list = response.datasets - - if response.action_id == "all" then - for i, dataset in datasets_list do - dataset.selected = "Y" - end - elseif response.action_id == "none" then - for i, dataset in datasets_list do - dataset.selected = "N" - end - else - local pkg_selected = {} - for i, dataset in datasets_list do - pkg_selected[dataset.package] = (dataset.selected == "Y") - end - return response.action_id == "ok", pkg_selected - end - end -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Subpartition.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Subpartition.lua deleted file mode 100644 index 7f473e572e..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/Subpartition.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: Subpartition.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/bitwise.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/bitwise.lua deleted file mode 100644 index cbcd9494dd..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/bitwise.lua +++ /dev/null @@ -1,43 +0,0 @@ --- lib/bitwise.lua --- $Id: bitwise.lua,v 1.1 2005/02/22 02:54:32 cpressey Exp $ --- Package for (pure-Lua portable but extremely slow) bitwise arithmetic. - --- BEGIN lib/bitwise.lua -- - ---[[---------]]-- ---[[ Bitwise ]]-- ---[[---------]]-- - -local odd = function(x) - return x ~= math.floor(x / 2) * 2 -end - -Bitwise = {} - -Bitwise.bw_and = function(a, b) - local c, pow = 0, 1 - while a > 0 or b > 0 do - if odd(a) and odd(b) then - c = c + pow - end - a = math.floor(a / 2) - b = math.floor(b / 2) - pow = pow * 2 - end - return c -end - -Bitwise.bw_or = function(a, b) - local c, pow = 0, 1 - while a > 0 or b > 0 do - if odd(a) or odd(b) then - c = c + pow - end - a = math.floor(a / 2) - b = math.floor(b / 2) - pow = pow * 2 - end - return c -end - --- END of lib/bitwise.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/cmdchain.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/cmdchain.lua deleted file mode 100644 index 63c65c2d77..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/cmdchain.lua +++ /dev/null @@ -1,467 +0,0 @@ --- $Id: cmdchain.lua,v 1.33 2005/03/26 23:36:13 cpressey Exp $ - -require "app" - ---[[-----------]]-- ---[[ CmdChains ]]-- ---[[-----------]]-- - --- Global "class" variable: -CmdChain = {} - --- Some 'symbolic constants': -CmdChain.LOG_SILENT = {} -CmdChain.LOG_QUIET = {} -CmdChain.LOG_VERBOSE = {} - -CmdChain.FAILURE_IGNORE = {} -CmdChain.FAILURE_WARN = {} -CmdChain.FAILURE_ABORT = {} - -CmdChain.RESULT_NEVER_EXECUTED = {} -CmdChain.RESULT_POPEN_ERROR = {} -CmdChain.RESULT_SELECT_ERROR = {} -CmdChain.RESULT_CANCELLED = {} -CmdChain.RESULT_SKIPPED = {} - --- Create a new command chain object instance. -CmdChain.new = function(...) - local chain = {} - local cmds = {} - local capture = {} - local replacements = {} - - -- - -- Private functions. - -- - - -- Fix up a command descriptor. If it is just a string, turn - -- it into a table; fill out any missing default values in the - -- table; and expand the string as appropriate. - local fix_cmd = function(cmd) - if type(cmd) == "string" then - cmd = { cmdline = cmd } - end - assert(type(cmd) == "table") - - if cmd.cmdline == nil then - cmd.cmdline = "" - end - assert(type(cmd.cmdline) == "string") - - if cmd.log_mode == nil then - cmd.log_mode = CmdChain.LOG_VERBOSE - end - assert(cmd.log_mode == CmdChain.LOG_SILENT or - cmd.log_mode == CmdChain.LOG_QUIET or - cmd.log_mode == CmdChain.LOG_VERBOSE) - - if cmd.failure_mode == nil then - cmd.failure_mode = CmdChain.FAILURE_ABORT - end - assert(cmd.failure_mode == CmdChain.FAILURE_IGNORE or - cmd.failure_mode == CmdChain.FAILURE_WARN or - cmd.failure_mode == CmdChain.FAILURE_ABORT) - - if cmd.replacements == nil then - cmd.replacements = {} - end - assert(type(cmd.replacements) == "table") - - cmd.cmdline = App.expand(cmd.cmdline, - cmd.replacements, replacements) - - cmd.display_cmdline = cmd.cmdline - - if cmd.on_executed ~= nil then - assert(type(cmd.on_executed) == "function") - end - - -- cmd.desc, cmd.tag, cmd.sensitive, cmd.on_executed, - -- and cmd.input are left as nil if not specified. - - return cmd - end - - -- Open a stream to a command to be executed, read from it, - -- and update the progress bar as data comes and (and/or as the - -- read from the stream times out.) - - -- Returns: - -- - the return value of the command on the other end of the stream; - -- - a boolean indicating whether it was cancelled by the user; and - -- - the output of the command, if requested (cmd.capture.) - - local stream_loop = function(pr, cmd) - local done = false - local cancelled = false - local pty - local output = {} - local cmdline - - local escape = function(pat) - return string.gsub(pat, "([^%w])", "%%%1") - end - - cmdline = "(" .. cmd.cmdline .. ") 2>&1" - if not cmd.input then - cmdline = cmdline .. " >> Exit status: " .. tostring(result)) - end - - if cancelled then - pr:stop() - done_command, result = interruption_dialog(cmd, cancelled, result) - pr:start() - elseif cmd.failure_mode == CmdChain.FAILURE_IGNORE then - result = 0 - done_command = true - elseif (result ~= 0 and cmd.failure_mode ~= CmdChain.FAILURE_WARN) then - pr:stop() - done_command, result = interruption_dialog(cmd, cancelled, result) - pr:start() - else - done_command = true - end - end - if cmd.on_executed ~= nil then - cmd.on_executed(cmd, result, output) - end - - return result, output - end - - -- - -- Methods. - -- - - -- - -- Set the global replacements for this command chain. - -- These will be applied to each command that is - -- subsequently added (although local replacements will - -- be applied first.) - -- - chain.set_replacements = function(cmd, new_replacements) - App.merge_tables(replacements, new_replacements, - function(key, dest_val, src_val) - return src_val - end) - end - - -- - -- Get captured output by its id. - -- - chain.get_output = function(cmd, cap_id) - return capture[cap_id] - end - - -- - -- Add one or more commands to this command chain. - -- - chain.add = function(chain, ...) - local cmd_no, cmd - - if table.getn(arg) == 0 then - return - end - - for cmd_no, cmd in ipairs(arg) do - table.insert(cmds, fix_cmd(cmd)) - end - end - - -- Execute a series of external utility programs. - -- Returns 1 if everything executed OK, 0 if one of the - -- critical commands failed or if the user cancelled. - chain.execute = function(chain) - local pr - local cmd - local i, n, result = 0, 0, 0 - local return_val = true - local output - - n = table.getn(cmds) - - pr = App.ui:new_progress_bar{ - title = "Executing Commands" - } - - pr:start() - - for i in cmds do - result, output = command_execute(pr, cmds[i]) - if result == CmdChain.RESULT_CANCELLED then - return_val = false - break - end - if type(result) == "number" and result > 0 and result < 256 then - return_val = false - if cmd.failure_mode == CmdChain.FAILURE_ABORT then - break - end - end - if cmds[i].capture then - capture[cmds[i].capture] = output - end - pr:set_amount((i * 100) / n) - end - - pr:stop() - - return return_val - end - - -- Show the commands that have been added to this - -- command chain to the user in a dialog box. - chain.preview = function(chain) - local contents = "" - local i, cmd - - for i, cmd in cmds do - contents = contents .. cmd.cmdline .. "\n" - end - - App.ui:present({ - id = "cmd_preview", - name = "Command Preview", - short_desc = contents, - role = "informative", - minimum_width = "72", - monospaced = "true", - actions = { - { id = "ok", name = "OK" } - } - }) - end - - -- Record these commands in a shell script file. - chain.record = function(chain, file) - local contents = "" - local i, cmd - - local gen_rand_string = function(len) - local n = 1 - local s = "" - local A = string.byte("A") - assert(len >= 0) - - while n <= len do - s = s .. string.char(math.random(A, A + 25)) - n = n + 1 - end - - return s - end - - local get_marker_for = function(text) - local s - - s = gen_rand_string(5) - while string.find(text, s, 1, true) do - s = gen_rand_string(5) - end - return s - end - - for i, cmd in cmds do - -- - -- Write lines apropos to the cmdline being - -- executed, taking in account the failure mode. - -- - if cmd.failure_mode == CmdChain.FAILURE_IGNORE then - file:write(cmd.cmdline) - elseif cmd.failure_mode == CmdChain.FAILURE_WARN then - file:write("(" .. cmd.cmdline .. " || " .. - "echo \"WARNING: " .. cmd.cmdline .. - " failed with exit code $?\")") - elseif cmd.failure_mode == CmdChain.FAILURE_ABORT then - file:write(cmd.cmdline) - end - - -- - -- If the command has input, include that as a heredoc. - - if cmd.input then - local marker = get_marker_for(cmd.input) - file:write(" <<" .. marker .. "\n" .. cmd.input .. marker) - end - - if cmd.failure_mode == CmdChain.FAILURE_WARN or - cmd.failure_mode == CmdChain.FAILURE_ABORT then - file:write(" && \\") - end - - -- - -- Write the description as a comment following. - -- - if cmd.desc then - file:write(" # " .. cmd.desc) - end - - file:write("\n") - end - end - - -- ``Constructor'' - initialize our instance data. - - if table.getn(arg) > 0 then - chain:add(unpack(arg)) - end - - return chain -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/configvars.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/configvars.lua deleted file mode 100644 index 718be4fdf1..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/configvars.lua +++ /dev/null @@ -1,105 +0,0 @@ --- $Id: configvars.lua,v 1.1 2004/11/28 03:52:05 cpressey Exp $ - -require "app" -require "cmdchain" - ---[[------------]]-- ---[[ ConfigVars ]]-- ---[[------------]]-- - -ConfigVars = {} -ConfigVars.new = function() - local cv = {} - local var = {} - - cv.get = function(cv, name) - return var[name] - end - - cv.set = function(cv, name, value) - var[name] = value - end - - -- - -- Populate this set of variables from a file. - -- - -- This isn't perfect. It doesn't handle variables - -- with embedded newlines, for example. It also - -- has to execute the script, which is undesirable. - -- - cv.read = function(cv, filename, filetype) - local cmds = CmdChain.new() - local diff, i - - cmds:add( - "set | ${root}${SORT} >${tmp}env.before", - { - cmdline = ". ${filename} && set | ${root}${SORT} >${tmp}env.after", - replacements = { - filename = filename - } - }, - { - cmdline = "${root}${COMM} -1 -3 ${tmp}env.before ${tmp}env.after", - capture = "comm" - }, - "${root}${RM} -f ${tmp}env.before ${tmp}env.after" - ) - - if not cmds:execute() then - return false - end - - diff = cmds:get_output("comm") - for i in diff do - local found, ends, k, v - - found, ends, k, v = - string.find(diff[i], "^([^=]+)='(.*)'$") - if found then - cv:set(k, v) - else - found, ends, k, v = - string.find(diff[i], "^([^=]+)=(.*)$") - if found then - cv:set(k, v) - end - end - end - - return true - end - - -- Write this set of configuration variable settings to a file. - cv.write = function(cv, filename, filetype) - local k, v - local file = io.open(filename, "a") - local written = false - - if not file then - return false - end - - for k, v in var do - if not written then - written = true - file:write("\n") - file:write("# -- BEGIN BSD Installer automatically generated configuration -- #\n") - file:write("# -- Written on " .. os.date() .. " -- #\n") - end - - file:write(k .. "='" .. v.. "'\n") - end - - if written then - file:write("# -- END of BSD Installer " .. - "automatically generated configuration -- #\n") - end - - file:close() - - return true - end - - return cv -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/flow.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/flow.lua deleted file mode 100644 index 3914e5ff7b..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/flow.lua +++ /dev/null @@ -1,149 +0,0 @@ --- lib/fsm.lua --- $Id: flow.lua,v 1.18 2005/03/29 21:04:19 cpressey Exp $ --- Framework for simple Finite State Machines in Lua. - --- BEGIN lib/fsm.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - --- Global "class" variable: -FSM = {} - --- Global "static methods": - --- Create a new FSM object instance. --- This object can then have states added to it with --- fsm:register(StateName, Function), and can be run --- with fsm:run(InitialStateName). -FSM.new = function() - local fsm = {} - local state = {} -- a dictionary of state name -> state - local sequence = {} -- an array of state number -> state - local current_state = nil -- reference to the current state - - fsm.register = function(fsm, tab) - state[tab.name] = { - name = tab.name, - title = tab.title, - action = tab.action, - position = table.getn(sequence) + 1 - } - table.insert(sequence, state[tab.name]) - end - - fsm.next = function(fsm) - return sequence[current_state.position + 1] - end - - fsm.prev = function(fsm) - return sequence[current_state.position - 1] - end - - fsm.current = function(fsm) - return current_state - end - - local resolve_state = function(x) - if type(x) == "string" then - if state[x] then - return state[x] - else - error("No state named '" .. x .. - "' exists in FSM") - end - elseif type(x) == "number" then - if sequence[x] then - return sequence[x] - else - error("No state number " .. tostring(x) .. - " exists in FSM") - end - elseif x == nil then - return nil - elseif type(x) == "table" then - local i, v - - for i, v in state do - if x == v then - return x - end - end - error("State object `" .. tostring(x) .. - "' does not exist in FSM") - end - error("Invalid state reference: " .. tostring(x)) - end - - fsm.run = function(fsm, start_state) - local result - - current_state = resolve_state(start_state) - while current_state do - if type(current_state.action) ~= "function" then - error("State '" .. current_state.name .. - "' does not define an action function") - else - result = current_state.action(fsm) - current_state = resolve_state(result) - end - end - end - - -- Note that we only return the table of functions; - -- we do not return the state table. However, a - -- reference ("upvalue" in Lua terminology) to the - -- state table is still carried along inside the - -- fsm function table; in this way it is retained, - -- and it is also protected from modification from - -- the outside (i.e. it is encapsulated.) - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the given directory. Each script --- should end with a return statement that returns a table --- describing the state. -FSM.from_dir = function(dir) - local fsm = FSM.new() - local file_no, files - local state, fun - local state_count = 0 - - files = POSIX.dir(dir) - table.sort(files) - - for file_no in files do - local full_file = dir .. "/" .. files[file_no] - local tab - - if files[file_no] ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(files[file_no], "^[^%.].*%.lua$") then - tab = App.run_script(full_file) - if tab then - fsm:register(tab) - state_count = state_count + 1 - end - end - end - - if state_count == 0 then - error("Directory " .. dir .. " should contain at least one FSM scriptlet") - end - - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -FSM.auto = function(start_state) - local path = FileName.dirname(App.current_script) - local fsm = FSM.from_dir(path) - - fsm:run(start_state) -end - --- END of lib/fsm.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/fsm.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/fsm.lua deleted file mode 100644 index 741444458d..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/fsm.lua +++ /dev/null @@ -1,149 +0,0 @@ --- lib/fsm.lua --- $Id: fsm.lua,v 1.18 2005/03/29 21:04:19 cpressey Exp $ --- Framework for simple Finite State Machines in Lua. - --- BEGIN lib/fsm.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - --- Global "class" variable: -FSM = {} - --- Global "static methods": - --- Create a new FSM object instance. --- This object can then have states added to it with --- fsm:register(StateName, Function), and can be run --- with fsm:run(InitialStateName). -FSM.new = function() - local fsm = {} - local state = {} -- a dictionary of state name -> state - local sequence = {} -- an array of state number -> state - local current_state = nil -- reference to the current state - - fsm.register = function(fsm, tab) - state[tab.name] = { - name = tab.name, - title = tab.title, - action = tab.action, - position = table.getn(sequence) + 1 - } - table.insert(sequence, state[tab.name]) - end - - fsm.next = function(fsm) - return sequence[current_state.position + 1] - end - - fsm.prev = function(fsm) - return sequence[current_state.position - 1] - end - - fsm.current = function(fsm) - return current_state - end - - local resolve_state = function(x) - if type(x) == "string" then - if state[x] then - return state[x] - else - error("No state named '" .. x .. - "' exists in FSM") - end - elseif type(x) == "number" then - if sequence[x] then - return sequence[x] - else - error("No state number " .. tostring(x) .. - " exists in FSM") - end - elseif x == nil then - return nil - elseif type(x) == "table" then - local i, v - - for i, v in state do - if x == v then - return x - end - end - error("State object `" .. tostring(x) .. - "' does not exist in FSM") - end - error("Invalid state reference: " .. tostring(x)) - end - - fsm.run = function(fsm, start_state) - local result - - current_state = resolve_state(start_state) - while current_state do - if type(current_state.action) ~= "function" then - error("State '" .. current_state.name .. - "' does not define an action function") - else - result = current_state.action(fsm) - current_state = resolve_state(result) - end - end - end - - -- Note that we only return the table of functions; - -- we do not return the state table. However, a - -- reference ("upvalue" in Lua terminology) to the - -- state table is still carried along inside the - -- fsm function table; in this way it is retained, - -- and it is also protected from modification from - -- the outside (i.e. it is encapsulated.) - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the given directory. Each script --- should end with a return statement that returns a table --- describing the state. -FSM.from_dir = function(dir) - local fsm = FSM.new() - local file_no, files - local state, fun - local state_count = 0 - - files = POSIX.dir(dir) - table.sort(files) - - for file_no in files do - local full_file = dir .. "/" .. files[file_no] - local tab - - if files[file_no] ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(files[file_no], "^[^%.].*%.lua$") then - tab = App.run_script(full_file) - if tab then - fsm:register(tab) - state_count = state_count + 1 - end - end - end - - if state_count == 0 then - error("Directory " .. dir .. " should contain at least one FSM scriptlet") - end - - return fsm -end - --- Create a new FSM object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -FSM.auto = function(start_state) - local path = FileName.dirname(App.current_script) - local fsm = FSM.from_dir(path) - - fsm:run(start_state) -end - --- END of lib/fsm.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/menu.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/menu.lua deleted file mode 100644 index f88c86bfae..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/menu.lua +++ /dev/null @@ -1,178 +0,0 @@ --- lib/menu.lua --- $Id: menu.lua,v 1.8 2005/03/29 21:04:19 cpressey Exp $ - --- BEGIN lib/menu.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - ---[[----------]]-- ---[[ MenuItem ]]-- ---[[----------]]-- - --- Global "class" variable. -MenuItem = {} - --- Global (but private) data and functions. -local next_id = 0 -- next unique id to create -local new_id = function() -- Create a new unique identifier. - next_id = next_id + 1 - return tostring(next_id) -end - --- Constructor. -MenuItem.new = function(tab) - local method = {} - local id = tab.id or "menu_action_" .. new_id() - local name = tab.name or "" - local short_desc = tab.short_desc - local long_desc = tab.long_desc - local effect = tab.effect - - method.to_action = function(item) - return { - id = id, - name = name, - short_desc = short_desc, - long_desc = long_desc, - effect = effect - } - end - - return method -end - ---[[------]]-- ---[[ Menu ]]-- ---[[------]]-- - --- Global "class" variable: -Menu = {} - --- Global (and public) symbolic constants: -Menu.CONTINUE = {} -Menu.DONE = {} - --- Global (but private) state variables in the class: -local menu_stack = {} -- stack of the most recently displayed menus -local make_exit_item = function() - local exit_item_name = "Exit" - - if table.getn(menu_stack) > 0 then - exit_item_name = "Return to " .. - menu_stack[table.getn(menu_stack)]:get_name() - end - - return { - name = exit_item_name, - effect = function() - return Menu.DONE - end - } -end - --- Create a new menu object instance. -Menu.new = function(opt) - local method = {} - local item = {} - local menu_id = opt.menu_id or "menu_form_" .. new_id() - local ui = opt.ui or App.ui - local name = opt.name or "" - local exit_item = opt.exit_item or make_exit_item() - local continue_constraint = opt.continue_constraint - - -- Private functions. - local map_items_to_actions = function(item) - local k, v - local action = {} - - for k, v in item do - action[k] = item[k]:to_action() - end - - return action - end - - -- Methods. - method.add_item = function(menu, tab) - -- XXX: if tab is already a MenuItem object, - -- just add it, else: - table.insert(item, MenuItem.new(tab)) - end - - method.get_name = function(menu) - return name - end - - -- - -- Populate this menu with items derived from the Lua script files - -- in the given directory. Each script should end with a return - -- statement that returns a table describing the menu item. - -- - method.from_dir = function(menu, dir) - local i, filename, filenames - - filenames = POSIX.dir(dir) - table.sort(filenames) - - for i, filename in filenames do - local full_file = dir .. "/" .. filename - - if filename ~= FileName.basename(App.current_script) and - not FileName.is_dir(full_file) and - string.find(filename, "^[^%.].*%.lua$") then - local tab = App.run_script(full_file) - if tab then - menu:add_item(tab) - end - end - end - - menu:add_item(exit_item) - - return menu - end - - -- - -- Present this menu to the user. - -- - method.present = function(menu) - table.insert(menu_stack, menu) - local response = ui:present({ - id = menu_id, - name = opt.name, - short_desc = opt.short_desc, - long_desc = opt.long_desc, - role = "menu", - actions = map_items_to_actions(item) - }) - table.remove(menu_stack) - return response - end - - method.loop = function(menu) - local result = Menu.CONTINUE - - while result == Menu.CONTINUE do - result = menu:present().result - if continue_constraint then - result = continue_constraint(result) - end - end - end - - return method -end - --- Create a new menu object instance automatically from --- the Lua script files in the same directory as the Lua --- script file that invoked this function. -Menu.auto = function(opt) - local menu = Menu.new(opt) - - menu:from_dir(FileName.dirname(App.current_script)) - menu:loop() -end - --- END of lib/menu.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/mountpoint.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/mountpoint.lua deleted file mode 100644 index fab9577bab..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/mountpoint.lua +++ /dev/null @@ -1,38 +0,0 @@ --- $Id: mountpoint.lua,v 1.1 2005/03/27 07:21:08 cpressey Exp $ - -MountPoints = {} - -MountPoints.enumerate = function() - local tab = {} - local pty, line, found, len - local device, mtpt, fstype, opts, dump, pass - local retval - - pty = Pty.open(App.expand("${root}${MOUNT} -p")) - if not pty then - return nil, "could not open pty to mount" - end - - line = pty:readline() - found = true - while line and found do - found, len, device, mtpt, fstype, opts, dump, pass = string.find(line, - "^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+(%d+)%s+(%d+)" - ) - if found then - table.insert(tab, { - device = device, - mountpoint = mtpt, - type = fstype - }) - end - line = pty:readline() - end - - retval = pty:close() - if retval ~= 0 then - return nil, "mount failed with return code " .. tostring(retval) - end - - return tab -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/network.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/network.lua deleted file mode 100644 index 50db96de1c..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/network.lua +++ /dev/null @@ -1,391 +0,0 @@ --- lib/network.lua --- $Id: network.lua,v 1.10 2005/03/27 01:19:41 cpressey Exp $ --- Lua abstraction for the Network Interfaces of a system. - --- BEGIN lib/network.lua -- - -require "app" -require "cmdchain" - ---[[------------------]]-- ---[[ NetworkInterface ]]-- ---[[------------------]]-- - --- --- This class returns an object which represents one of the system's --- network interfaces. --- --- This class is not typically instantiated directly by client code. --- Instead, the user should call NetworkInterface.all() to get a table --- of all network interfaces present in the system, and choose one. --- -NetworkInterface = {} -NetworkInterface.new = function(name) - local ni = {} -- instance variable - local desc = name -- description of device - local up -- internal state... - local mtu - local inet6, prefixlen, scopeid - local inet, netmask, broadcast - local ether - - local toboolean = function(x) - if x then - return true - else - return false - end - end - - -- - -- Probe this network interface for its current state. - -- - -- dc0: flags=8843 mtu 1500 - -- inet6 fe80::250:bfff:fe96:cf68%dc0 prefixlen 64 scopeid 0x1 - -- inet 10.0.0.19 netmask 0xffffff00 broadcast 10.0.0.255 - -- ether 00:50:bf:96:cf:68 - -- media: Ethernet autoselect (10baseT/UTP) - -- - ni.probe = function(ni) - local found, len, cap, flagstring - local pty - - up = nil - mtu = nil - inet6, prefixlen, scopeid = nil, nil, nil - inet, netmask, broadcast = nil, nil, nil - - pty = Pty.open(App.expand("${root}${IFCONFIG} ${name}", { name = name })) - if not pty then - return nil, "could not open pty" - end - line = pty:readline() - while line do - found, len, cap, flagstring = - string.find(line, "flags%s*=%s*(%d+)%s*%<([^%>]*)%>") - if found then - flagstring = "," .. flagstring .. "," - up = toboolean(string.find(flagstring, ",UP,")) - end - - found, len, cap = string.find(line, "mtu%s*(%d+)") - if found then - mtu = tonumber(cap) - end - found, len, cap = string.find(line, "inet6%s*([^%s]+)") - if found then - inet6 = cap - end - found, len, cap = string.find(line, "prefixlen%s*(%d+)") - if found then - prefixlen = tonumber(cap) - end - found, len, cap = string.find(line, "scopeid%s*0x(%x+)") - if found then - scopeid = cap - end - found, len, cap = string.find(line, "inet%s*(%d+%.%d+%.%d+%.%d+)") - if found then - inet = cap - end - found, len, cap = string.find(line, "netmask%s*0x(%x+)") - if found then - netmask = cap - end - found, len, cap = string.find(line, "broadcast%s*(%d+%.%d+%.%d+%.%d+)") - if found then - broadcast = cap - end - found, len, cap = string.find(line, "ether%s*(%x%x%:%x%x%:%x%x%:%x%x%:%x%x%:%x%x%)") - if found then - ether = cap - end - line = pty:readline() - end - pty:close() - end - - -- - -- Accessor methods. - -- - - ni.is_up = function(ni) - return up - end - - ni.get_name = function(ni) - return name - end - - ni.get_inet_addr = function(ni) - return inet - end - - ni.get_netmask = function(ni) - return netmask - end - - ni.get_broadcast_addr = function(ni) - return broadcast - end - - ni.get_ether_addr = function(ni) - return ether - end - - ni.get_desc = function(ni) - return desc - end - - ni.set_desc = function(ni, new_desc) - -- - -- Calculate a score for how well this string describes - -- a network interface. Reject obviously bogus descriptions - -- (usually harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%<.*%>") then - score = score + 10 - end - - -- Look for irrelevancies - if string.find(s, "MII bus") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - -- - -- Set the description of a device, as best we can, based on - -- the available system information. - -- - ni.auto_describe = function(ni) - -- - -- First give some common pseudo-devices some - -- reasonable 'canned' descriptions. - -- - local descs = { - ["ppp%d+"] = "Point-to-Point Protocol device", - ["sl%d+"] = "Serial Line IP device", - ["faith%d+"] = "IPv6-to-IPv4 Tunnel device", - ["lp%d+"] = "Network Line Printer device", - ["lo%d+"] = "Loopback device" - } - for pat, desc in descs do - if string.find(name, "^" .. pat .. "$") then - ni:set_desc(name .. ": " .. desc) - end - end - - -- - -- Now look through dmesg.boot for the names of - -- physical network interface hardware. - -- - for line in io.lines("/var/run/dmesg.boot") do - local found, len, cap = - string.find(line, "^" .. name .. ":.*(%<.*%>).*$") - if found then - ni:set_desc(name .. ": " .. cap) - end - end - end - - -- - -- CmdChain-creating methods. - -- - - ni.cmds_assign_inet_addr = function(ni, cmds, addr) - cmds:add({ - cmdline = "${root}${IFCONFIG} ${name} ${addr}", - replacements = { - name = name, - addr = addr - } - }) - end - - ni.cmds_assign_netmask = function(ni, cmds, netmask) - cmds:add({ - cmdline = "${root}${IFCONFIG} ${name} netmask ${netmask}", - replacements = { - name = name, - netmask = netmask - } - }) - end - - ni.cmds_dhcp_configure = function(ni, cmds) - cmds:add( - { - cmdline = "${root}${KILLALL} dhclient", - failure_mode = CmdChain.FAILURE_IGNORE - }, - { - cmdline = "${root}${DHCLIENT} -1 ${name}", - replacements = { - name = name - } - } - ) - end - - return ni -end - ---[[-------------------]]-- ---[[ NetworkInterfaces ]]-- ---[[-------------------]]-- - --- --- A container/aggregate class. Contains a bunch of NetworkInterface --- objects, typically the set of those available on a given system. --- - -NetworkInterfaces = {} - -NetworkInterfaces.new = function() - local ni_tab = {} - local method = {} - - method.add = function(nis) - ni_tab[ni.name] = ni - end - - method.get = function(nis, name) - return ni_tab[name] - end - - -- Iterator, typically used in for loops. - method.each = function(nis) - local name, ni - local list = {} - local i, n = 0, 0 - - for name, ni in ni_tab do - table.insert(list, ni) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- - -- Populate the NetworkInterface collection with all the - -- network interfaces detected as present in the system. - -- - method.probe = function(nis) - local pty, line, name, ni, line, pat, desc - - pty = Pty.open(App.expand("${root}${IFCONFIG} -l")) - if not pty then - return nil, "could not open pty" - end - line = pty:readline() - pty:close() - - ni_tab = {} - - for name in string.gfind(line, "%s*([^%s]+)%s*") do - ni = NetworkInterface.new(name) - ni:probe() - ni:auto_describe() - ni_tab[name] = ni - end - - return nis - end - - -- - -- Returns the number of configured IP addresses of all the - -- NetworkInterface objects in this NetworkInterfaces object. - -- - -- Practically, used for asking "Uh, is the network on?" :) - -- - method.ip_addr_count = function(nis) - local name, ni - local num = 0 - - for name, ni in ni_tab do - ip_addr = ni:get_inet_addr() - if ip_addr and not string.find(ip_addr, "^127%..*$") then - num = num + 1 - end - end - - return num - end - - -- - -- User-interface methods. - -- - - -- - -- Display a dialog box, allow the user to select which - -- network interface they want to use. - -- - method.ui_select_interface = function(nis, tab) - local actions, ni, ifname - if not tab then tab = {} end - local ui = tab.ui or App.ui - local id = tab.id or "select_interface" - local name = tab.name or _("Select Network Interface") - local short_desc = tab.short_desc or _( - "Please select the network interface you wish to configure." - ) - - -- - -- Get interface list. - -- - actions = {} - for ni in nis:each() do - table.insert(actions, { - id = ni:get_name(), - name = ni:get_desc() - }) - end - table.insert(actions, { - id = "cancel", - name = "Cancel" - }) - - ifname = App.ui:present({ - id = id, - name = name, - short_desc = short_desc, - role = "menu", - actions = actions - }).action_id - - if ifname == "cancel" then - return nil - else - return nis:get(ifname) - end - end - - return method -end - --- END of lib/network.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/package.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/package.lua deleted file mode 100644 index a8e5e4ff3a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/package.lua +++ /dev/null @@ -1,224 +0,0 @@ --- lib/package.lua --- $Id: package.lua,v 1.13 2005/04/04 18:59:20 cpressey Exp $ --- Installer package functions written in Lua. - --- BEGIN lib/package.lua -- - -local POSIX = require("posix") -local FileName = require("filename") -local App = require("app") - -require "cmdchain" - ---[[---------]]-- ---[[ Package ]]-- ---[[---------]]-- - --- This 'class' currently only contains static global methods --- for dealing with packages. There is no 'package object.' - -Package = {} - --- --- Determine whether a package is installed on a HDD. --- -Package.exists = function(base, pkg_name) - return FileName.is_dir( - App.expand("${root}${base}var/db/pkg/${pkg_name}", { - base = base, - pkg_name = pkg_name - }) - ) -end - -Package.list_all = function(base) - local i, filename, list - local dir = POSIX.dir( - App.expand("${root}${base}var/db/pkg", { - base = base - }) - ) - - list = {} - for i, filename in ipairs(dir) do - if filename ~= "." and filename ~= ".." then - table.insert(list, filename) - end - end - - return list -end - --- --- Methods which construct command-chains. --- - --- --- Delete all packages from a given base. --- -Package.cmds_clean = function(base, cmds) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} '*'", - replacements = { base = base } - }) -end - --- --- Create commands to copy a package from the installation media onto --- the target system. --- --- This function returns the number of packages that will be copied --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_copy = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, rpkg_name, line, pkg_suffix - local depcount = 0 - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively copy them first, if they're not already there, - -- and if we've not already seen them. - -- - -- It woulld be nice if we could send this command through a command - -- chain so that we could get an accurate idea of what is being - -- run and so that it will be logged. But unfortunately that's - -- not feasible, since this function is building another command - -- chain for later use. So we use a pty. - -- - pty = Pty.open(App.expand("${root}${PKG_INFO} -r ") .. pkg_name) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that begin with 'Dependency:'. - -- - local found, len, rpkg_name = - string.find(line, "^Dependency:%s*([^%s]+)") - if found and not Package.exists(base, rpkg_name) then - local subcount = Package.cmds_copy( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - line = pty:readline() - end - pty:close() - - pkg_suffix = "tgz" - if App.os.name == "FreeBSD" then - pkg_suffix = "tbz" - end - - if not Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:set_replacements{ - base = base, - pkg_name = pkg_name, - pkg_suffix = pkg_suffix - } - cmds:add( - "${root}${PKG_CREATE} -b ${pkg_name} ${root}${base}tmp/${pkg_name}.${pkg_suffix}", - { - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PKG_ADD} /tmp/${pkg_name}.${pkg_suffix}", - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }, - "${root}${RM} ${root}${base}tmp/${pkg_name}.${pkg_suffix}" - ) - end - - return depcount -end - --- --- Remove a package from a target system. --- --- This function returns the number of packages that will be removed --- by the commands it has created, or nil if an error occurs. --- -Package.cmds_remove = function(base, cmds, pkg_name, pkg_seen, pkg_done) - local pty, line - local command, rpkg_name - local depcount = 0 - local seen_required_by = false - pkg_seen = pkg_seen or {} - pkg_done = pkg_done or {} - - -- - -- Get all the packages that this package depends on, and - -- recursively delete them. - -- - pty = Pty.open(App.expand( - "${root}${CHROOT} ${root}${base} /${PKG_INFO} -R ${pkg_name}", { - base = base, - pkg_name = pkg_name - } - )) - if not pty then - return nil - end - - line = pty:readline() - while line do - -- - -- Only look at lines that follow the "Required by:" line. - -- - if seen_required_by then - found, len, rpkg_name = - string.find(line, "^%s*([^%s]+)") - if found and Package.exists(base, rpkg_name) then - local subcount = Package.cmds_remove( - base, cmds, rpkg_name, pkg_seen, pkg_done - ) - if subcount == nil then - pty:close() - return nil - end - depcount = depcount + subcount - end - else - if string.find(line, "^Required by:") then - seen_required_by = true - end - end - line = pty:readline() - end - pty:close() - - if Package.exists(base, pkg_name) and not pkg_seen[pkg_name] then - pkg_seen[pkg_name] = true - depcount = depcount + 1 - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PKG_DELETE} ${pkg_name}", - replacements = { - base = base, - pkg_name = pkg_name - }, - tag = pkg_name, - on_executed = function(cmd, result, output) - if result == 0 then - pkg_done[cmd.tag] = true - end - end - }) - end - - return depcount -end - --- END of lib/package.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage.lua deleted file mode 100644 index e7c3ae4be9..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage.lua +++ /dev/null @@ -1,1265 +0,0 @@ --- lib/storage.lua --- $Id: storage.lua,v 1.76 2005/03/29 21:04:19 cpressey Exp $ --- Storage Descriptors (a la libinstaller) in Lua. - --- BEGIN lib/storage.lua -- - -local App = require("app") -local FileName = require("filename") -require "cmdchain" -require "bitwise" -require "mountpoint" - --- --- Note: these methods should try to use consistent terminology: --- --- 'capacity' of an object refers to its capacity in megabytes. --- 'size' of an object refers to its size in blocks or sectors --- (which are assumed to be 512 bytes each.) --- 'capstring' refers to a string which includes a unit suffix: --- 'M' for megabytes --- 'G' for gigabytes --- '*' to indicate 'use the remaining space on the device' --- - ---[[-------------------]]-- ---[[ StorageDescriptor ]]-- ---[[-------------------]]-- - --- This class returns an object which can represent --- the system's data storage capabilities. - -StorageDescriptor = {} -StorageDescriptor.new = function() - local disk = {} -- disks in this storage descriptor - local ram = 0 -- in megabytes - local sd = {} -- instance variable - - -- Internal function. - local next_power_of_two = function(n) - local i = 1 - n = math.ceil(n) - - while i < n and i >= 1 do - i = i * 2 - end - - if i > n then - return i - else - return n - end - end - - -- Now set up this object's interface functions - - -- Look through `dmesg', `atacontrol list', etc, and - -- populate disks and ram with values - -- that are as accurate and readable as possible. - -- XXX not yet fully implemented. - sd.survey = function(sd) - local pty, line - local disk_name, dd - local cmd - local found, len, cap - - cmd = App.expand("${root}${SYSCTL} -n hw.physmem") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - ram = next_power_of_two(tonumber(line) / (1024 * 1024)) - - cmd = App.expand("${root}${SYSCTL} -n kern.disks") - pty = Pty.open(cmd) - line = pty:readline() - pty:close() - - App.log("`" .. cmd .. "` returned: " .. line) - - for disk_name in string.gfind(line, "%s*(%w+)") do - if not string.find(disk_name, "^md") then - disk[disk_name] = DiskDescriptor.new(sd, disk_name) - end - end - - for line in io.lines("/var/run/dmesg.boot") do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^" .. disk_name .. ":%s*(.*)$") - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - end - - cmd = App.expand("${root}${ATACONTROL} list") - pty = Pty.open(cmd) - line = pty:readline() - while line do - for disk_name, dd in disk do - found, len, cap = - string.find(line, "^%s*Master:%s*" .. - disk_name .. "%s*(%<.*%>)$") - if not found then - found, len, cap = - string.find(line, "^%s*Slave:%s*" .. - disk_name .. "%s*(%<.*%>)$") - end - if found then - dd:set_desc(disk_name .. ": " .. cap) - end - end - line = pty:readline() - end - pty:close() - end - - -- Refresh our view of the storage connected to the - -- system, but remember what disk and/or partition - -- was selected as well. - sd.resurvey = function(sd, sel_disk, sel_part) - local sel_disk_name, sel_part_no - - if sel_disk then - sel_disk_name = sel_disk:get_name() - end - - if sel_part then - sel_part_no = sel_part:get_number() - end - - sd:survey() - - if sel_disk then - sel_disk = sd:get_disk_by_name(sel_disk_name) - if not sel_disk then - -- XXX warn that sel disk was lost! - end - end - - if sel_disk and sel_part then - sel_part = sel_disk:find_part_by_number(sel_part_no) - if not sel_part then - -- XXX warn that sel part was lost! - end - end - - return sel_disk, sel_part - end - - -- Return an iterator which yields the next next - -- DiskDescriptor object in this StorageDescriptor - -- each time it is called (typically in a for loop.) - sd.get_disks = function(sd) - local disk_name, dd - local list = {} - local i, n = 0, 0 - - for disk_name, dd in disk do - table.insert(list, dd) - n = n + 1 - end - - table.sort(list, function(a, b) - return a:get_name() < b:get_name() - end) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - -- Given the name of a disk, return that disk descriptor, - -- or nil if no disk by that name was found. - sd.get_disk_by_name = function(sd, name) - local dd - - for dd in sd:get_disks() do - if dd:get_name() == name then - return dd - end - end - - return nil - end - - sd.get_disk_count = function(sd) - local disk_name, dd - local n = 0 - - for disk_name, dd in disk do - n = n + 1 - end - - return n - end - - sd.get_ram = function(sd) -- in megabytes - return ram - end - - sd.get_activated_swap = function(sd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - swap = swap + tonumber(amount) - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - sd.dump = function(sd) - local disk_name, dd - - print("*** DUMP of StorageDescriptor ***") - for disk_name, dd in disk do - dd:dump() - end - end - - return sd -end - --- --- The following global static utility functions in the --- StorageDescriptor class are really human interface functions; --- they might be better placed elsewhere. --- - --- --- Take a capstring and return a number indicating size in blocks. --- If the capstring is "*", the supplied remainder is returned. --- If the capstring could not be parsed, returns nil. --- -StorageDescriptor.parse_capstring = function(str, remainder) - if str == "*" then - return remainder - else - local suffix = string.sub(str, -1, -1) - local body = string.sub(str, 1, string.len(str) - 1) - - if suffix == "G" or suffix == "g" then - return math.floor(tonumber(body) * 1024 * 1024 * 2) - elseif suffix == "M" or suffix == "m" then - return math.floor(tonumber(body) * 1024 * 2) - else - -- bad suffix - return nil - end - end -end - --- --- Takes a number specifying a size in blocks and --- convert it to a capstring. --- -StorageDescriptor.format_capstring = function(blocks) - if blocks >= 1024 * 1024 * 2 then - return tostring(math.floor(blocks / (1024 * 1024 * 2) * 100) / 100) .. "G" - else - return tostring(math.floor(blocks / (1024 * 2) * 100) / 100) .. "M" - end -end - - ---[[----------------]]-- ---[[ DiskDescriptor ]]-- ---[[----------------]]-- - -DiskDescriptor = {} -DiskDescriptor.new = function(parent, name) - local dd = {} -- instance variable - local part = {} -- private: partitions on this disk - local desc = name -- private: description of disk - local cyl, head, sec -- private: geometry of disk - local touched = false -- private: whether we formatted it - - -- Set up this object instance's interface functions first: - - dd.get_parent = function(dd) - return parent - end - - dd.get_name = function(dd) - return name - end - - dd.set_desc = function(dd, new_desc) - -- - -- Calculate a score for how well this string describes - -- a disk. Reject obviously bogus descriptions (usually - -- erroneously harvested from error messages in dmesg.) - -- - local calculate_score = function(s) - local score = 0 - - -- In the absence of any good discriminator, - -- the longest disk description wins. - score = string.len(s) - - -- Look for clues - if string.find(s, "%d+MB") then - score = score + 10 - end - if string.find(s, "%<.*%>") then - score = score + 10 - end - if string.find(s, "%[%d+%/%d+%/%d+%]") then - score = score + 10 - end - - -- Look for error messages - if string.find(s, "resetting") then - score = 0 - end - - return score - end - - if calculate_score(new_desc) > calculate_score(desc) then - desc = new_desc - end - end - - dd.get_desc = function(dd) - return desc - end - - dd.get_geometry = function(dd) - return cyl, head, sec - end - - dd.get_device_name = function(dd) - return name - end - - dd.get_raw_device_name = function(dd) - -- XXX depends on operating system - return name - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - dd.get_parts = function(dd) - local i, n = 0, table.getn(part) - - return function() - if i <= n then - i = i + 1 - return part[i] - end - end - end - - -- Given the number of a partition, return that - -- partition descriptor, or nil if not found. - dd.get_part_by_number = function(dd, number) - local pd - - for pd in dd:get_parts() do - if pd:get_number() == number then - return pd - end - end - - return nil - end - - dd.get_part_count = function(dd) - return table.getn(part) - end - - -- return the disk's capacity in megabytes. - -- this is actually the sum of the capacities of the - -- partitions on this disk. - dd.get_capacity = function(dd) - local pd - local cap = 0 - - for pd in dd:get_parts() do - cap = cap + pd:get_capacity() - end - - return cap - end - - -- return the disk's raw size in sectors. - dd.get_raw_size = function(dd) - pty = Pty.open(App.expand( - "${root}${FDISK} -t -I " .. - dd:get_raw_device_name())) - line = pty:readline() - while line do - local found, len, start, size = - string.find(line, "start%s*(%d+)%s*,%s*size%s*(%d+)") - if found then - pty:close() - return tonumber(start) + tonumber(size) - end - line = pty:readline() - end - pty:close() - - return nil - end - - dd.touch = function(dd) - touched = true - end - - dd.has_been_touched = function(dd) - return touched - end - - -- - -- Determine whether any subpartition from any partition of this - -- disk is mounted somewhere in the filesystem. - -- - dd.is_mounted = function(dd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = dd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to manipulate the contents of this DiskDescriptor. - -- - - dd.clear_parts = function(dd) - part = {} - end - - dd.add_part = function(dd, pd) - part[pd:get_number()] = pd - -- pd:set_parent(dd) - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - dd.cmds_ensure_dev = function(dd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(dd:get_device_name()) - } - }) - end - - -- Commands to format this disk. - dd.cmds_format = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - - -- - -- Currently you need to pass 'yes' to OpenBSD's fdisk to - -- be able to do these. (This is a shot in the dark:) - -- - if App.os.name == "OpenBSD" then - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${ECHO} 'yes\nyes\nyes\n' | " .. - "${root}${FDISK} -B " .. - dd:get_raw_device_name()) - else - cmds:add("${root}${FDISK} -I " .. - dd:get_raw_device_name()) - cmds:add("${root}${YES} | ${root}${FDISK} -B " .. - dd:get_raw_device_name()) - end - end - - -- Commands to partition this disk. - dd.cmds_partition = function(dd, cmds) - local i, pd - local active_part_no - local cyl, head, sec = dd:get_geometry() - - dd:cmds_ensure_dev(cmds) - - cmds:add({ - cmdline = "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - replacements = { - cyl = cyl, - head = head, - sec = sec - } - }) - - i = 1 - while i <= 4 do - local sysid, start, size = 0, 0, 0 - - pd = dd:get_part_by_number(i) - if pd then - sysid = pd:get_sysid() - start = pd:get_start() - size = pd:get_size() - if pd:is_active() then - active_part_no = pd:get_number() - end - end - - cmds:add({ - cmdline = "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk", - replacements = { - number = i, - sysid = sysid, - start = start, - size = size - } - }) - - i = i + 1 - end - - if active_part_no then - cmds:add({ - cmdline = "${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk", - replacements = { - number = active_part_no - } - }) - end - - cmds:add("${root}${CAT} ${tmp}new.fdisk") - - App.register_tmpfile("new.fdisk") - - -- - -- Execute the fdisk script. - -- - cmds:add("${root}${FDISK} -v -f ${tmp}new.fdisk " .. - dd:get_raw_device_name()) - end - - dd.cmds_install_bootblock = function(dd, cmds, packet_mode) - local o = " " - if packet_mode then - o = "-o packet " - end - cmds:add( - { - cmdline = "${root}${BOOT0CFG} -B " .. - o .. dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - }, - { - cmdline = "${root}${BOOT0CFG} -v " .. - dd:get_raw_device_name(), - failure = CmdChain.FAILURE_WARN, - tag = dd - } - ) - end - - dd.cmds_wipe_start = function(dd, cmds) - dd:cmds_ensure_dev(cmds) - cmds:add("${root}${DD} if=${root}dev/zero of=${root}dev/" .. - dd:get_raw_device_name() .. " bs=32k count=16") - end - - dd.dump = function(dd) - local part_no - - print("\t" .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec .. ": " .. desc) - for part_no in part do - part[part_no]:dump() - end - end - - -- 'Constructor' - initialize our private state. - -- Try to find out what we can about ourselves from fdisk. - - local pty, line, found, len - - -- Get the geometry from 'fdisk'. - pty = Pty.open(App.expand("${root}${FDISK} " .. name)) - line = pty:readline() - while line and not found do - found = string.find(line, "^%s*parameters to be used for BIOS") - line = pty:readline() - end - - if found then - found, len, cyl, head, sec = - string.find(line, "^%s*cylinders=(%d+)%s*heads=(%d+)%s*" .. - "sectors/track=(%d+)") - cyl = tonumber(cyl) - head = tonumber(head) - sec = tonumber(sec) - end - pty:close() - - if not found then - App.log("Warning! Could not determine geometry of disk " .. name .. "!") - return nil - end - - App.log("New Disk: " .. name .. ": " .. cyl .. "/" .. head .. "/" .. sec) - - -- Get the partitions from 'fdisk -s'. - pty = Pty.open(App.expand("${root}${FDISK} -s " .. name)) - line = pty:readline() -- geometry - we already have it - line = pty:readline() -- headings, just ignore - line = pty:readline() - while line do - local part_no, start, size, sysid, flags - found, len, part_no, start, size, sysid, flags = - string.find(line, "^%s*(%d+):%s*(%d+)%s*(%d+)" .. - "%s*0x(%x+)%s*0x(%x+)%s*$") - if found then - part_no = tonumber(part_no) - part[part_no] = PartitionDescriptor.new{ - parent = dd, - number = part_no, - start = tonumber(start), - size = tonumber(size), - sysid = tonumber(sysid, 16), - flags = tonumber(flags, 16) - } - end - line = pty:readline() - end - pty:close() - - return dd -end - ---[[---------------------]]-- ---[[ PartitionDescriptor ]]-- ---[[---------------------]]-- - -PartitionDescriptor = {} -PartitionDescriptor.new = function(params) - local pd = {} -- instance variable - local subpart = {} -- subpartitions on this partition - - local parent = assert(params.parent) - local number = assert(params.number) - local start = assert(params.start) - local size = assert(params.size) - local sysid = assert(params.sysid) - local flags = params.flags - if params.active ~= nil then - if params.active then - flags = 256 - else - flags = 0 - end - end - assert(type(flags) == "number") - - -- First set up this object's interface functions - - pd.get_parent = function(pd) - return parent - end - - pd.get_number = function(pd) - return number - end - - pd.get_params = function(pd) - return start, size, sysid, flags - end - - pd.get_start = function(pd) - return start - end - - pd.get_size = function(pd) - return size - end - - pd.get_sysid = function(pd) - return sysid - end - - pd.get_flags = function(pd) - return flags - end - - -- 'size' is the partition size, in blocks. - -- return the partition's capacity in megabytes. - pd.get_capacity = function(pd) - return math.floor(size / 2048) - end - - pd.is_active = function(pd) - return Bitwise.bw_and(flags, 256) == 256 - end - - pd.get_desc = function(pd) - return tostring(number) .. ": " .. - tostring(pd:get_capacity()) .. "M (" .. - tostring(start) .. "-" .. tostring(start + size) .. - ") id=" .. sysid - end - - pd.get_device_name = function(pd) - return parent.get_name() .. "s" .. number - end - - pd.get_raw_device_name = function(pd) - -- XXX depends on operating system - return parent.get_name() .. "s" .. number -- .. "c" - end - - pd.get_activated_swap = function(pd) -- in megabytes - local pty, line - local swap = 0 - local found, len, devname, amount - - pty = Pty.open(App.expand("${root}${SWAPINFO} -k")) - line = pty:readline() - while line do - if not string.find(line, "^Device") then - found, len, devname, amount = - string.find(line, "^([^%s]+)%s+(%d+)") - if string.find(devname, pd:get_device_name()) then - swap = swap + tonumber(amount) - end - end - line = pty:readline() - end - pty:close() - - return math.floor(swap / 1024) - end - - -- Return an iterator which yields the next next - -- PartitionDescriptor object in this DiskDescriptor - -- each time it is called (typically in a for loop.) - pd.get_subparts = function(pd) - local letter, spd - local list = {} - local i, n = 0, 0 - - for letter, spd in subpart do - table.insert(list, spd) - end - - table.sort(list, function(a, b) - -- not sure why we ever get a nil here, but we do: - if not a and not b then return false end - - return a:get_letter() < b:get_letter() - end) - - n = table.getn(list) - - return function() - if i <= n then - i = i + 1 - return list[i] - end - end - end - - pd.clear_subparts = function(pd) - subpart = {} - end - - pd.add_subpart = function(pd, spd) - subpart[spd:get_letter()] = spd - -- spd:set_parent(pd) - end - - pd.get_subpart_by_letter = function(pd, letter) - return subpart[letter] - end - - pd.get_subpart_by_mountpoint = function(pd, mountpoint) - local letter, spd - - for letter, spd in subpart do - if spd:get_mountpoint() == mountpoint then - return spd - end - end - - return nil - end - - pd.get_subpart_by_device_name = function(pd, device_name) - local letter, spd - - -- Strip any leading /dev/ or whatever. - device_name = FileName.basename(device_name) - - for letter, spd in subpart do - if spd:get_device_name() == device_name then - return spd - end - end - - return nil - end - - -- - -- Determine whether any subpartition of this - -- partition is mounted somewhere in the filesystem. - -- - pd.is_mounted = function(pd) - local fs_descs = MountPoints.enumerate() - local i, fs_desc, dev_name - - dev_name = pd:get_device_name() - for i, fs_desc in fs_descs do - if string.find(fs_desc.device, dev_name, 1, true) then - return true - end - end - - return false - end - - -- - -- Methods to add appropriate commands to CmdChains. - -- - - -- Commands to ensure this device exists. - pd.cmds_ensure_dev = function(pd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(pd:get_device_name()) - } - }) - end - - -- Commands to format this partition. - pd.cmds_format = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - - -- The information in parent NEEDS to be accurate here! - -- Presumably we just did a survey_storage() recently. - - -- - -- Set the slice's sysid to 165. - -- - - local cyl, head, sec = parent:get_geometry() - local start, size, sysid, flags = pd:get_params() - - cmds:set_replacements{ - cyl = cyl, - head = head, - sec = sec, - number = pd:get_number(), - sysid = 165, - start = start, - size = size, - dev = pd:get_raw_device_name(), - parent_dev = parent:get_raw_device_name() - } - - cmds:add( - "${root}${ECHO} 'g c${cyl} h${head} s${sec}' >${tmp}new.fdisk", - "${root}${ECHO} 'p ${number} ${sysid} ${start} ${size}' >>${tmp}new.fdisk" - ) - - if pd:is_active() then - cmds:add("${root}${ECHO} 'a ${number}' >>${tmp}new.fdisk") - end - - App.register_tmpfile("new.fdisk") - - -- - -- Dump the fdisk script to the log for debugging. - -- Execute the fdisk script - -- Auto-disklabel the slice. - -- Remove any old disklabel that might be hanging around. - -- - cmds:add( - "${root}${CAT} ${tmp}new.fdisk", - "${root}${FDISK} -v -f ${tmp}new.fdisk ${parent_dev}", - "${root}${DISKLABEL} -B -r -w ${dev} auto", - "${root}${RM} -f ${tmp}install.disklabel.${parent_dev}" - ) - end - - pd.cmds_wipe_start = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - cmds:add( - "${root}${DD} if=${root}dev/zero of=${root}dev/" .. - pd:get_raw_device_name() .. " bs=32k count=16" - ) - end - - pd.cmds_install_bootstrap = function(pd, cmds) - pd:cmds_ensure_dev(cmds) - -- - -- NB: one cannot use "/dev/adXsY" here - - -- it must be in the form "adXsY". - -- - cmds:add( - "${root}${DISKLABEL} -B " .. - pd:get_raw_device_name() - ) - return cmds - end - - pd.cmds_disklabel = function(pd, cmds) - -- Disklabel the given partition with the - -- subpartitions attached to it. - - local num_parts = 8 - if App.os.name == "DragonFly" then - num_parts = 16 - end - - cmds:set_replacements{ - part = pd:get_device_name(), - num_parts = tostring(num_parts) - } - - if not FileName.is_file(App.dir.tmp .. "install.disklabel" .. pd:get_device_name()) then - -- - -- Get a copy of the 'virgin' disklabel. - -- XXX It might make more sense for this to - -- happen right after format_slice() instead. - -- - cmds:add("${root}${DISKLABEL} -r ${part} >${tmp}install.disklabel.${part}") - end - - -- - -- Weave together a new disklabel out the of the 'virgin' - -- disklabel, and the user's subpartition choices. - -- - - -- - -- Take everything from the 'virgin' disklabel up until the - -- '8 or 16 partitions' line, which looks like: - -- - -- 8 or 16 partitions: - -- # size offset fstype [fsize bsize bps/cpg] - -- c: 2128833 0 unused 0 0 # (Cyl. 0 - 2111*) - -- - - cmds:add( - "${root}${AWK} '$2==\"partitions:\" || cut { cut = 1 } !cut { print $0 }' " .. - "<${tmp}install.disklabel.${part} >${tmp}install.disklabel", - "${root}${ECHO} '${num_parts} partitions:' >>${tmp}install.disklabel", - "${root}${ECHO} '# size offset fstype [fsize bsize bps/cpg]' " .. - ">>${tmp}install.disklabel" - ) - - -- - -- Write a line for each subpartition the user wants. - -- - - local spd = nil - local copied_original = false - - for spd in pd:get_subparts() do - if spd:get_letter() > "c" and not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel. - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} " .. - ">>${tmp}install.disklabel") - copied_original = true - end - - cmds:set_replacements{ - letter = spd:get_letter(), - fsize = spd:get_fsize(), - bsize = spd:get_bsize() - } - - if spd:get_letter() == "a" then - cmds:set_replacements{ offset = "0" } - else - cmds:set_replacements{ offset = "*" } - end - if spd:get_size() == -1 then - cmds:set_replacements{ size = "*" } - else - cmds:set_replacements{ size = tostring(spd:get_size()) } - end - - if spd:is_swap() then - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t*\tswap' >>${tmp}install.disklabel") - else - cmds:add("${root}${ECHO} ' ${letter}:\t${size}\t${offset}\t4.2BSD\t${fsize}\t${bsize}\t99' >>${tmp}install.disklabel") - end - end - - if not copied_original then - -- - -- Copy the 'c' line from the 'virgin' disklabel, - -- if we haven't yet (less than 2 subpartitions.) - -- - cmds:add("${root}${GREP} '^ c:' ${tmp}install.disklabel.${part} >>${tmp}install.disklabel") - end - - App.register_tmpfile("install.disklabel") - - -- - -- Label the slice from the disklabel we just wove together. - -- - -- Then create a snapshot of the disklabel we just created - -- for debugging inspection in the log. - -- - cmds:add( - "${root}${DISKLABEL} -R -B -r ${part} ${tmp}install.disklabel", - "${root}${DISKLABEL} ${part}" - ) - - -- - -- Create filesystems on the newly-created subpartitions. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - - for spd in pd:get_subparts() do - if not spd:is_swap() then - spd:cmds_ensure_dev(cmds) - - if spd:is_softupdated() then - cmds:add("${root}${NEWFS} -U ${root}dev/" .. - spd:get_device_name()) - else - cmds:add("${root}${NEWFS} ${root}dev/" .. - spd:get_device_name()) - end - end - end - end - - pd.cmds_write_fstab = function(pd, cmds, filename) - -- Write a new fstab for the given partition - -- to the given filename. - - if not filename then - filename = "${root}mnt/etc/fstab" - end - - cmds:set_replacements{ - header = "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#", - procline = "proc\t\t\t/proc\t\tprocfs\trw\t\t0\t0", - device = "???", - mountpoint = "???", - filename = App.expand(filename) - } - - cmds:add("${root}${ECHO} '${header}' >${filename}") - - for spd in pd:get_subparts() do - cmds:set_replacements{ - device = spd:get_device_name(), - mountpoint = spd:get_mountpoint() - } - - if spd:get_mountpoint() == "/" then - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t1\t1' >>${filename}") - elseif spd:is_swap() then - cmds:add("${root}${ECHO} '/dev/${device}\t\tnone\t\tswap\tsw\t\t0\t0' >>${filename}") - else - cmds:add("${root}${ECHO} '/dev/${device}\t\t${mountpoint}\t\tufs\trw\t\t2\t2' >>${filename}") - end - end - - cmds:add("${root}${ECHO} '${procline}' >>${filename}") - end - - pd.dump = function(pd) - local letter, spd - - print("\t\tPartition " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - for spd in pd:get_subparts() do - spd:dump() - end - end - - App.log("New Partition: " .. number .. ": " .. - start .. "," .. size .. ":" .. sysid .. "/" .. flags) - - -- 'Constructor' - initialize this object's state. - -- If this looks like a BSD slice, try to probe it with - -- disklabel to get an idea of the subpartitions on it. - - local pty, line, found, len - local letter, size, offset, fstype, fsize, bsize - - if sysid == 165 then - pty = Pty.open(App.expand("${root}${DISKLABEL} " .. parent:get_name() .. - "s" .. number)) - line = pty:readline() - found = false - while line and not found do - found = string.find(line, "^%d+%s+partitions:") - line = pty:readline() - end - if found then - while line do - found, len, letter, size, offset, fstype, - fsize, bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*(%d+)%s*([^%s]+)") - if found then - fsize, bsize = 0, 0 - if fstype == "4.2BSD" then - found, len, letter, size, - offset, fstype, fsize, - bsize = string.find(line, - "^%s*(%a):%s*(%d+)%s*" .. - "(%d+)%s*([^%s]+)%s*" .. - "(%d+)%s*(%d+)") - end - subpart[letter] = - SubpartitionDescriptor.new{ - parent = pd, - letter = letter, - size = size, - offset = offset, - fstype = fstype, - fsize = fsize, - bsize = bsize - } - end - line = pty:readline() - end - end - - pty:close() - end - - return pd -end - ---[[------------------------]]-- ---[[ SubpartitionDescriptor ]]-- ---[[------------------------]]-- - -SubpartitionDescriptor = {} -SubpartitionDescriptor.new = function(params) - local spd = {} -- instance variable - - local parent = assert(params.parent) - local letter = assert(params.letter) - local size = assert(params.size) - local offset = assert(params.offset) - local fstype = assert(params.fstype) - local fsize = assert(params.fsize) - local bsize = assert(params.bsize) - local mountpoint = params.mountpoint - - -- Now set up this object's interface functions - - spd.get_parent = function(spd) - return parent - end - - spd.get_letter = function(spd) - return letter - end - - spd.set_mountpoint = function(spd, new_mountpoint) - mountpoint = new_mountpoint - end - - spd.get_mountpoint = function(spd) - return mountpoint - end - - spd.get_fstype = function(spd) - return fstype - end - - spd.get_device_name = function(spd) - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_raw_device_name = function(spd) - -- XXX depends on operating system - return parent.get_parent().get_name() .. - "s" .. parent.get_number() .. letter - end - - spd.get_capacity = function(spd) -- in megabytes - return math.floor(size / 2048) - end - - spd.get_size = function(spd) -- in sectors - return size - end - - spd.get_fsize = function(spd) - return fsize - end - - spd.get_bsize = function(spd) - return bsize - end - - spd.is_swap = function(spd) - return fstype == "swap" - end - - spd.is_softupdated = function(spd) - -- XXX this should be a property - return mountpoint ~= "/" - end - - spd.dump = function(pd) - print("\t\t\t" .. letter .. ": " .. offset .. "," .. size .. - ": " .. fstype .. " -> " .. mountpoint) - end - - -- Commands to ensure this device exists. - spd.cmds_ensure_dev = function(spd, cmds) - cmds:add({ - cmdline = "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - replacements = { - dev = FileName.basename(spd:get_device_name()) - } - }) - end - - -- - -- Constructor. - -- - - App.log("New Subpartition on " .. parent:get_device_name() .. ": " .. - letter .. ": " .. offset .. "," .. size .. ": " .. fstype .. - " F=" .. fsize .. ", B=" .. bsize) - - return spd -end - --- END of lib/storage.lua -- diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage_ui.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage_ui.lua deleted file mode 100644 index 196a9f2e42..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/storage_ui.lua +++ /dev/null @@ -1,182 +0,0 @@ --- $Id: storage_ui.lua,v 1.6 2005/04/04 20:50:59 cpressey Exp $ - -require "gettext" - ---[[-----------]]-- ---[[ StorageUI ]]-- ---[[-----------]]-- - -StorageUI = {} - --- Function to present a form to the user from which they --- can select any disk present in the given StorageDescriptor. - -StorageUI.select_disk = function(tab) - local dd - local disk_actions = {} - - local sd = tab.sd or error("Need a storage descriptor") - - local add_disk_action = function(tdd) - table.insert(disk_actions, - { - id = tdd:get_name(), - name = tdd:get_desc(), - effect = function() - return tdd - end - } - ) - end - - for dd in sd:get_disks() do - add_disk_action(dd) - end - - table.insert(disk_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_disk", - name = tab.name or _("Select a Disk"), - short_desc = tab.short_desc or _("Select a disk."), - long_desc = tab.long_desc, - actions = disk_actions, - role = "menu" - }).result -end - --- Function to present a form to the user from which they --- can select any partition present in the given DiskDescriptor. - -StorageUI.select_part = function(tab) - local pd - local part_actions = {} - - local dd = tab.dd or error("Need a disk descriptor") - - local add_part_action = function(tpd) - table.insert(part_actions, - { - id = tostring(tpd:get_number()), - name = tpd:get_desc(), - effect = function() - return tpd - end - } - ) - end - - for pd in dd:get_parts() do - add_part_action(pd) - end - - table.insert(part_actions, - { - id = "cancel", - name = tab.cancel_desc or _("Cancel"), - effect = function() - return nil - end - } - ) - - return App.ui:present({ - id = tab.id or "select_part", - name = tab.name or _("Select a Partition"), - short_desc = tab.short_desc or _("Select a partition."), - long_desc = tab.long_desc, - actions = part_actions, - role = "menu" - }).result -end - -StorageUI.select_packages = function(tab) - local datasets_list = {} - local pkg, selected, i, dataset - - if not tab.sel_pkgs then - tab.sel_pkgs = {} - end - for pkg, selected in tab.sel_pkgs do - table.insert(datasets_list, { - selected = (selected and "Y") or "N", - package = pkg - }) - end - table.sort(datasets_list, function(a, b) - return a.package < b.package - end) - - local fields_list = { - { - id = "selected", - name = tab.checkbox_name or _("Install?"), - control = "checkbox" - }, - { - id = "package", - name = _("Full Name of Package"), - editable = "false" - } - } - - local actions_list = { - { - id = "all", - name = tab.all_name or _("Select All") - }, - { - id = "none", - name = tab.none_name or _("Select None") - }, - { - id = "ok", - name = tab.ok_name or _("Accept these Packages") - }, - { - id = "cancel", - name = tab.cancel_name or _("Cancel") - } - } - - while true do - local response = App.ui:present({ - id = tab.id or "select_packages", - name = tab.name or _("Select Packages"), - short_desc = tab.short_desc or - _("Select the packages you wish to install."), - long_desc = tab.long_desc, - actions = actions_list, - fields = fields_list, - datasets = datasets_list, - - multiple = "true" - }) - - datasets_list = response.datasets - - if response.action_id == "all" then - for i, dataset in datasets_list do - dataset.selected = "Y" - end - elseif response.action_id == "none" then - for i, dataset in datasets_list do - dataset.selected = "N" - end - else - local pkg_selected = {} - for i, dataset in datasets_list do - pkg_selected[dataset.package] = (dataset.selected == "Y") - end - return response.action_id == "ok", pkg_selected - end - end -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/target_system.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/target_system.lua deleted file mode 100644 index ad775a8abe..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/lib/target_system.lua +++ /dev/null @@ -1,644 +0,0 @@ --- $Id: target_system.lua,v 1.25 2005/03/29 21:04:19 cpressey Exp $ - -local App = require("app") -local FileName = require("filename") -require "gettext" -require "cmdchain" -require "storage" -require "mountpoint" - ---[[--------------]]-- ---[[ TargetSystem ]]-- ---[[--------------]]-- - -TargetSystem = {} - --- --- There are three general use cases for this class. --- --- The first case is when mounting a virgin target system --- for a fresh install. In this situation, the needed --- mountpoint directories (taken from the subpartition descriptors --- in the partition descriptor) are created on the target system --- before being mounted: --- --- local ts = TargetSystem.new(pd, "mnt") --- if ts:create() then --- if ts:mount() then --- ... --- ts:unmount() --- end --- end --- --- The second case is when mounting an existing target system --- for configuration. In this situation, the root partition is --- mounted, then the file /etc/fstab on that partition is parsed, --- and everything that can reasonably be mounted from that is. --- --- local ts = TargetSystem.new(pd, "mnt") --- if ts:probe() then --- if ts:mount() then --- ... --- ts:unmount() --- end --- end --- --- The third case is when configuring the booted system, such as --- when the configurator may be started from the installed system --- itself. In this case, no mounting is necessary. But the target --- system must know that this is the case, so that it need not --- e.g. uselessly chroot to itself. --- --- local ts = TargetSystem.new(pd) --- if ts:use_current() then --- ... --- end --- -TargetSystem.new = function(pd, base) - local ts = {} -- instance variable - local fstab = nil -- our representation of fstab - local root_is_mounted = false -- flag: is the root fs mounted? - local is_mounted = false -- flag: is everything mounted? - local using_current = false -- flag: using booted system? - - -- - -- Private utility helper functions. - -- - - -- - -- Unmount all mountpoints under a given directory. Recursively unmounts - -- dependent mountpoints, so that unmount_all'ing /mnt will first unmount - -- /mnt/usr/local, then /mnt/usr, then /mnt itself. - -- - -- The third argument is generally not necessary when calling this function; - -- it is used only when it recursively calls itself. - -- - local unmount_all_under - unmount_all_under = function(cmds, dirname, fs_descs) - local unmount_me = false - local i - - if not dirname then - dirname = App.expand("${root}${base}", { - base = base - }) - dirname = FileName.remove_trailing_slash(dirname) - end - - if not fs_descs then - fs_descs = MountPoints.enumerate() - end - - for i, fs_desc in fs_descs do - if fs_desc.mountpoint == dirname then - unmount_me = true - end - - if string.sub(fs_desc.mountpoint, 1, string.len(dirname)) == dirname and - string.len(dirname) < string.len(fs_desc.mountpoint) then - unmount_all_under(cmds, fs_desc.mountpoint, fs_descs) - end - end - - if unmount_me then - cmds:add({ - cmdline = "${root}${UMOUNT} ${dirname}", - replacements = { dirname = dirname } - }) - end - end - - -- - -- Convert the options for swap-backed devices from their - -- fstab format to command line format. - -- - local convert_swap_options = function(opts) - local opt - local result = "" - - for opt in string.gfind(opts, "[^,]") do - -- - -- Honour options that begin with -, but - -- don't bother trying to honour the -C - -- option, since we can't copy files from - -- the right place anyway. - -- - if string.find(opt, "^-[^C]") then - result = result .. - string.gsub(opt, "=", " ") .. " " - end - end - - return result - end - - -- - -- Mount this TargetSystem's root filesystem. - -- Note: this doesn't just queue up commands, it actually does it. - -- This is necessary for reading /etc/fstab. - -- Any optimizations will come later... - -- - local mount_root_filesystem = function(ts) - local cmds, spd - - if root_is_mounted then - return false, "Root filesystem is already mounted" - end - - -- - -- Create a command chain. - -- - cmds = CmdChain.new() - - -- - -- Find the root subpartition of the partition. - -- It's always the first one, called "a". - -- - spd = pd:get_subpart_by_letter("a") - - -- - -- If there isn't one, then this partition isn't - -- correctly formatted. One possible cause is - -- an incomplete formatting operation; perhaps the - -- partition was disklabeled, but never newfs'ed. - -- - if not spd then - return false - end - - -- - -- Ensure that the devices we'll be using exist. - -- - pd:get_parent():cmds_ensure_dev(cmds) - pd:cmds_ensure_dev(cmds) - spd:cmds_ensure_dev(cmds) - - -- - -- Make sure nothing is mounted under where we want - -- to mount this filesystem. - -- - unmount_all_under(cmds) - - -- - -- Mount the target's root filesystem - -- - cmds:add({ - cmdline = "${root}${MOUNT} ${root}dev/${dev} ${root}${base}", - replacements = { - dev = spd:get_device_name(), - base = base - } - }) - - -- - -- Do it. - -- - root_is_mounted = cmds:execute() - return root_is_mounted - end - - -- - -- Accessor methods. - -- - - ts.get_part = function(ts) - return(pd) - end - - ts.get_base = function(ts) - return(base) - end - - ts.is_mounted = function(ts) - return(is_mounted) - end - - -- - -- Command-generating methods. - -- - - ts.cmds_set_password = function(ts, cmds, username, password) - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} " .. - "/${PW} usermod ${username} -h 0", - replacements = { - base = base, - username = username - }, - desc = _("Setting password for user `%s'...", username), - input = password .. "\n", - sensitive = password - }) - end - - ts.cmds_add_user = function(ts, cmds, tab) - - local add_flag = function(flag, setting) - if setting ~= nil and setting ~= "" then - return flag .. " " .. tostring(setting) - else - return "" - end - end - - local home_skel = "" - if not tab.home or not FileName.is_dir(tab.home) then - home_skel = "-m -k /usr/share/skel" - end - - cmds:add({ - cmdline = "${root}${CHROOT} ${root}${base} /${PW} useradd " .. - "'${username}' ${spec_uid} ${spec_gid} -c \"${gecos}\"" .. - "${spec_home} -s ${shell} ${spec_groups} ${home_skel}", - replacements = { - base = base, - username = assert(tab.username), - gecos = tab.gecos or "Unnamed User", - shell = tab.shell or "/bin/sh", - spec_uid = add_flag("-u", tab.uid), - spec_gid = add_flag("-g", tab.group), - spec_home = add_flag("-d", tab.home), - spec_groups = add_flag("-G", tab.groups), - home_skel = home_skel - }, - }) - - if tab.password then - ts:cmds_set_password(cmds, tab.username, tab.password) - end - end - - -- - -- Create commands to copy files and directories to the traget system. - -- - ts.cmds_install_srcs = function(ts, cmds, srclist) - local i, src, dest, spd - - -- - -- Only bother to copy the mountpoint IF: - -- o We have said to copy it at some point - -- (something in srclist is a prefix of it); and - -- o We have not already said to copy it - -- (it is not a prefix of anything in srclist.) - -- - local is_valid_mountpoint = function(root, mountpoint) - local seen_it = false - local i, src - - local starts_with = function(str, prefix) - return string.sub(str, string.len(prefix)) == prefix - end - - for i, src in ipairs(srclist) do - if starts_with(mountpoint, root .. src) then - seen_it = true - end - if starts_with(root .. src, mountpoint) then - return false - end - end - - return seen_it - end - - for i, src in ipairs(srclist) do - -- - -- Create intermediate directories as needed. - -- - cmds:add{ - cmdline = "${root}${MKDIR} -p ${root}${base}${src_dir}", - replacements = { - base = base, - src_dir = FileName.dirname(src) - } - } - - -- - -- If a source by the same name but with the suffix - -- ".hdd" exists on the installation media, cpdup that - -- instead. This is particularly useful with /etc, which - -- may have significantly different behaviour on the - -- live CD compared to a standard HDD boot. - -- - dest = src - if FileName.is_dir(App.dir.root .. src .. ".hdd") or - FileName.is_file(App.dir.root .. src .. ".hdd") then - src = src .. ".hdd" - end - - -- - -- Cpdup the chosen source onto the HDD. - -- - cmds:add({ - cmdline = "${root}${CPDUP} ${root}${src} ${root}${base}${dest}", - replacements = { - base = base, - src = src, - dest = dest - }, - log_mode = CmdChain.LOG_QUIET -- don't spam log - }) - end - - -- - -- Now, because cpdup does not cross mount points, - -- we must copy anything that the user might've made a - -- seperate mount point for (e.g. /usr/libdata/lint.) - -- - for spd in pd:get_subparts() do - -- - -- Only copy files into the subpartition if: - -- o It is a regular (i.e. not swap) subpartition, and - -- o A directory exists on the install medium for it - -- - - -- - -- This assumes that the subpartition descriptors - -- have mountpoints associated with them, which should - -- (nowadays) always be the case. - -- - if spd:get_fstype() == "4.2BSD" and - FileName.is_dir(App.dir.root .. spd:get_mountpoint()) then - if is_valid_mountpoint(App.dir.root, spd:get_mountpoint()) then - -- - -- Cpdup the subpartition. - -- - -- XXX check for .hdd-extended source dirs here, too, - -- eventually - but for now, /etc.hdd will never be - -- the kind of tricky sub-mount-within-a-mount-point - -- that this part of the code is meant to handle. - -- - cmds:add{ - cmdline = "${root}${CPDUP} ${root}${mtpt} " .. - "${root}${base}${mtpt}", - replacements = { - base = base, - mtpt = spd:get_mountpoint() - }, - log_mode = CmdChain.LOG_QUIET - } - end - end - end - end - - -- - -- Create mountpoint directories on a new system, based on what - -- the user wants (the subpartition descriptors under the given - -- partition descriptor) and return a fstab structure describing them. - -- - ts.create = function(ts) - local spd, cmds - - -- - -- Mount the target system's root filesystem, - -- if not already mounted - -- - if not root_is_mounted then - if not mount_root_filesystem() then - return false - end - end - - -- - -- Create mount points for later mounting of subpartitions. - -- - cmds = CmdChain.new() - fstab = {} - for spd in pd:get_subparts() do - local mtpt = spd:get_mountpoint() - local dev = spd:get_device_name() - - cmds:set_replacements{ - base = base, - dev = dev, - mtpt = FileName.remove_leading_slash(mtpt) - } - - if spd:is_swap() then - if App.option.enable_crashdumps and - spd:get_capacity() >= App.state.store:get_ram() then - -- - -- Set this subpartition as the dump device. - -- - cmds:add("${root}${DUMPON} -v ${root}dev/${dev}") - App.state.crash_device = mnt_dev - end - fstab[mtpt] = { - device = "/dev/" .. dev, - fstype = "swap", - options = "sw", - dump = 0, - pass = 0 - } - else - if spd:get_mountpoint() ~= "/" then - cmds:add("${root}${MKDIR} -p ${root}${base}${mtpt}") - end - fstype = "ufs" - opts = "rw" - fstab[mtpt] = { - device = "/dev/" .. dev, - fstype = "ufs", - options = "rw", - dump = 2, - pass = 2 - } - if mtpt == "/" then - fstab[mtpt].dump = 1 - fstab[mtpt].pass = 1 - end - end - end - return cmds:execute() - end - - -- - -- Parse the fstab of a mounted target system. - -- Returns either a table representing the fstab, or - -- nil plus an error message string. - -- - -- As a side effect, this function also associates mountpoints - -- with the subpartition descriptors under the partition - -- descriptor with which this target system is associated. - -- - ts.probe = function(ts) - local fstab_filename, fstab_file, errmsg - local spd - - -- - -- Mount the target system's root filesystem, - -- if not already mounted. - -- - if not root_is_mounted then - if not mount_root_filesystem() then - return nil, "Could not mount / of target system." - end - end - - -- - -- Open the target system's fstab and parse it. - -- - fstab_filename = App.expand("${root}${base}etc/fstab", { - base = base - }) - fstab_file, errmsg = io.open(fstab_filename, "r") - if not fstab_file then - return nil, "Could not open /etc/fstab of target system." - end - - fstab = {} - line = fstab_file:read() - while line do - -- - -- Parse the fstab line. - -- - if string.find(line, "^%s*#") then - -- comment: skip it - elseif string.find(line, "^%s*$") then - -- blank line: skip it - else - local found, len, dev, mtpt, fstype, opts, dump, pass = - string.find(line, "%s*([^%s]*)%s*([^%s]*)%s*" .. - "([^%s]*)%s*([^%s]*)%s*([^%s]*)%s*([^%s]*)") - if not found then - App.log("Warning: malformed line in fstab: " .. - line) - else - fstab[mtpt] = { - device = dev, - fstype = fstype, - options = opts, - dump = dump, - pass = pass - } - spd = pd:get_subpart_by_device_name(dev) - if fstype ~= "ufs" then - -- Don't associate non-ufs - -- fs's with any mountpoint. - elseif not spd then - -- This can happen if e.g. - -- the user has included a - -- subpartition from another - -- drive in their fstab. - else - -- Associate mountpoint. - spd:set_mountpoint(mtpt) - end - end - end - line = fstab_file:read() - end - fstab_file:close() - - return fstab - end - - ts.use_current = function(ts) - using_current = true - base = "/" - return true - end - - -- - -- Mount the system on the given partition into the given mount - -- directory (typically "mnt".) - -- - ts.mount = function(ts) - local cmds, i, mtpt, mtpts, fsdesc - - if using_current or is_mounted then - return true - end - - if not root_is_mounted or fstab == nil then - return false - end - - -- - -- Go through each of the mountpoints in our fstab, - -- and if it looks like we should, try mount it under base. - -- - - mtpts = {} - for mtpt, fsdesc in fstab do - table.insert(mtpts, mtpt) - end - table.sort(mtpts) - - cmds = CmdChain.new() - for i, mtpt in mtpts do - fsdesc = fstab[mtpt] - if mtpt == "/" then - -- It's already been mounted by - -- read_target_fstab() or create_mountpoints. - elseif string.find(fsdesc.options, "noauto") then - -- It's optional. Don't mount it. - elseif (not string.find(fsdesc.device, "^/dev/") and - fsdesc.device ~= "swap") then - -- Device doesn't start with /dev/ and - -- it isn't 'swap'. Don't even go near it. - elseif mtpt == "none" or fsdesc.fstype == "swap" then - -- Swap partition. Don't mount it. - elseif fsdesc.device == "swap" then - -- It's swap-backed. mount_mfs it. - - cmds:add({ - cmdline = "${root}${MOUNT_MFS} ${swap_opts} swap ${root}${base}${mtpt}", - replacements = { - swap_opts = convert_swap_options(fsdesc.options), - base = base, - mtpt = FileName.remove_leading_slash(mtpt) - } - }) - else - -- If we got here, it must be normal and valid. - cmds:set_replacements{ - dev = FileName.basename(fsdesc.device), - opts = fsdesc.options, -- XXX this may need further cleaning? - base = base, - mtpt = FileName.remove_leading_slash(mtpt) - } - cmds:add( - "cd ${root}dev && ${root}${TEST_DEV} ${dev} || " .. - "${root}${SH} MAKEDEV ${dev}", - "${root}${MOUNT} -o ${opts} ${root}dev/${dev} ${root}${base}${mtpt}" - ) - end - end - - is_mounted = cmds:execute() - return is_mounted - end - - -- - -- Unmount the target system. - -- - ts.unmount = function(ts) - if using_current or - (not is_mounted and not root_is_mounted) then - return true - end - local cmds = CmdChain.new() - unmount_all_under(cmds) - if cmds:execute() then - is_mounted = false - root_is_mounted = false - return true - else - return false - end - end - - -- - -- 'Constructor' - initialize instance state. - -- - - -- - -- Fix up base. - -- - base = base or "" - base = FileName.add_trailing_slash(base) - - return ts -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/main.lua deleted file mode 100644 index b427776615..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/main.lua +++ /dev/null @@ -1,89 +0,0 @@ --- demo/main.lua --- $Id: main.lua,v 1.19 2005/04/03 20:28:22 cpressey Exp $ --- Main menu for demonstration application for dfuibe_lua. - -App = require "app"; App.init() -require "storage" -require "dfui" -require "fsm" -require "menu" -require "storage_ui" -require "target_system" - -Pty = require("pty") - -GetText = require "gettext" -GetText.set_package("dfuibe_lua") -GetText.set_locale_dir("/usr/local/share/locale") -GetText.init() - -App.start{ - name = "Demonstration App", - logfile = "demo.log", - ui = DFUI.new{ - transport = "tcp", -- XXX default from command line options... - rendezvous = "9999" - } -} - --- --- Set one of the following options to run this installer in `mock mode': --- --- App.option.fake_execution = true -- don't actually execute anything --- App.option.confirm_execution = true -- always ask before executing --- --- You might also wish to change the root from whence things are drawn: --- --- App.dir.root = "/usr/release/root/" -- or what have you --- --- These can be set from the dfuibe_lua command line like so: --- option.fake_execution=true dir.root=/usr/release/root --- - --- Create a storage-descriptor for the application. -App.state.storage = StorageDescriptor.new() -App.state.storage:survey() - --- put welcome notify-box here - --- --- First let the user configure the important user-interface aspects --- of their system (language, keyboard/screenmap if on console, --- internet connection for logging to remote machine over net, etc.) --- --- These are termed "pre-install tasks" even though that is a slight --- misnomer (and an unfortunate acronym): --- -App.descend("pit") - -Menu.auto{ - name = "Select Task", - short_desc = "Choose one of the following tasks to perform.", - continue_constraint = function(result) - if App.state.do_reboot then - return Menu.DONE - else - return result - end - end -} - --- --- If there is a target system mounted, unmount it before leaving. --- -if App.state.target ~= nil and App.state.target:is_mounted() then - if not App.state.target:unmount() then - App.ui:inform( - _("Warning: subpartitions were not correctly unmounted.") - ) - end -end - -App.stop() - -if App.state.do_reboot then - -- exit with reboot code - os.exit(5) -else - os.exit(0) -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/500_setup_server.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/500_setup_server.lua deleted file mode 100644 index c3485fe937..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/500_setup_server.lua +++ /dev/null @@ -1,102 +0,0 @@ --- $Id: 500_setup_server.lua,v 1.2 2005/03/29 12:12:15 den Exp $ - --- Setup a remote boot installation environment where a machine --- can boot via DHCP/TFTP/NFS and have a running environment --- where the installer can setup the machine. - --- --- Create the commands necessary for setting up a remote boot server. --- -local start_netboot_server = function(cmds, tab) - local nic = assert(tab.nic) - local ip_addr = tab.ip_addr or "10.1.0.1" - local netmask = tab.netmask or "255.255.255.0" - - cmds:add{ - cmdline = "${root}${IFCONFIG} ${if_name} ${ip_addr} netmask ${netmask}", - replacements = { - if_name = nic:get_name(), - ip_addr = ip_addr, - netmask = netmask - } - } - cmds:add( - "${root}${MKDIR} -p ${tmp}tftpdroot", - "${root}${CP} ${root}boot/pxeboot ${tmp}tftpdroot", - "${root}${ECHO} / -ro -alldirs >>${root}etc/exports", - "${root}${ECHO} /cdrom -ro -alldirs >>${root}etc/exports", - "${root}${ECHO} tftp dgram udp wait root " .. - "${root}${TFTPD} tftpd -l -s ${tmp}tftpdroot " .. - ">>${root}etc/inetd.conf", - "${root}${INETD}", - "${root}${TOUCH} ${root}var/db/dhcpd.leases", - "${root}${DHCPD} >${root}dev/null 2>&1", - "${root}${RPCBIND} >${root}dev/null 2>&1", - "${root}${MOUNTD} -ln >${root}dev/null 2>&1", - "${root}${NFSD} -u -t -n 6 >${root}dev/null 2>&1" - ) -end - -return { - name = "setup_server", - title = "Set Up NetBoot Server", - action = function(fsm) - - -- Probe interfaces if not already done... - if not App.state.net_if then - App.state.net_if = NetworkInterfaces.new() - App.state.net_if:probe() - end - - local response = App.ui:present{ - name = _("Enable NetBoot Installation Services?"), - short_desc = - _("NetBoot Installation Services allow this machine to become " .. - "an Installation Server that will allow other machines " .. - "on this network to boot as PXE clients, and will start the " .. - "Installation Environment on them.\n\n" .. - "*NOTE!* This will assign the IP Address of 10.1.0.1/24 to " .. - "the selected interface.\n\n" .. - "Would you like to provision this machine to serve up the " .. - "Installation Environment to other machines?"), - actions = { - { - id = "ok", - name = _("Enable NetBoot Installation Services") - }, - { - id = "cancel", - name = _("No thanks") - } - } - } - - if response.action_id == "ok" then - local ni - - ni = App.state.net_if:ui_select_interface() - if not ni then - return nil - end - - local cmds = CmdChain.new() - start_netboot_server(cmds, { - nic = ni, - ip_addr = "10.1.0.1" - }) - if cmds:execute() then - App.ui:inform( - _("NetBoot installation services are now started.") - ) - else - App.ui:inform( - _("A failure occured while provisioning " .. - "the NetBoot environment. Please " .. - "consult the log file for details.") - ) - end - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/main.lua deleted file mode 100644 index a27cde0481..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/netboot/main.lua +++ /dev/null @@ -1,3 +0,0 @@ --- $Id: main.lua,v 1.1 2005/03/27 01:46:09 cpressey Exp $ - -FSM.auto("setup_server") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/100_select_language.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/100_select_language.lua deleted file mode 100644 index 545f145407..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/100_select_language.lua +++ /dev/null @@ -1,28 +0,0 @@ --- $Id: 100_select_language.lua,v 1.3 2005/02/24 23:08:04 cpressey Exp $ - -require "gettext" - -return { - name = "language", - title = "Select Language", - action = function(fsm) - local actions = {} - local sel_lang = nil - - -- for i in languages do table.insert(actions, language_action) end - table.insert(actions, { - id = "en", - name = _("English") - }) - - sel_lang = App.ui:present({ - id = "select_language", - name = _("Select Language"), - short_desc = _("Please select your preferred language."), - role = "menu", - actions = actions - }).action_id - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/800_configure_network.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/800_configure_network.lua deleted file mode 100644 index 4d601f9e98..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/800_configure_network.lua +++ /dev/null @@ -1,189 +0,0 @@ --- $Id: 800_configure_network.lua,v 1.7 2005/03/27 01:20:40 cpressey Exp $ - -require "gettext" -require "network" -require "configvars" - --- XXX Several of the functions in this script should be in --- XXX scripts/demo/lib/network_ui.lua (or something) instead. - -local execute_and_wait_for = function(ni, cmds) - if cmds:execute() then - if App.wait_for{ - predicate = function() - ni:probe() - return ni:is_up() - end, - timeout = 30, - frequency = 2, - short_desc = _( - "Waiting for interface %s to come up...", - ni:get_name() - ) - } then - -- show_ifconfig(a->c, interface); - App.ui:inform(_( - "Interface\n\n%s\n\nis now up, with IP address %s.", - ni:get_desc(), ni:get_inet_addr() - )) - return true - else - -- show_ifconfig(a->c, interface); - App.ui:inform(_( - "Interface\n\n%s\n\nfailed to come up.", - ni:get_desc() - )) - return false - end - else - return false - end -end - -local dhcp_configure = function(ni) - local cmds = CmdChain.new() - - ni:cmds_dhcp_configure(cmds) - return execute_and_wait_for(ni, cmds) -end - -local static_configure = function(ni) - local response = App.ui:present{ - id = "assign_ip", - name = _("Assign IP Address"), - short_desc = _("Configuring Interface:"), - fields = { - { - id = "ip", - name = _("IP Address"), - short_desc = _("Enter the IP Address you would like to use") - }, - { - id = "netmask", - name = _("Netmask"), - short_desc = _("Enter the netmask of the IP address") - }, - { - id = "default_router", - name = _("Default Router"), - short_desc = _("Enter the IP address of the default router") - }, - { - id = "primary_dns", - name = _("Primary DNS Server"), - short_desc = _("Enter the IP address of primary DNS Server") - }, - { - id = "host", - name = _("Hostname") - }, - { - id = "domain", - name = _("Domain Name") - } - }, - actions = { - { - id = "ok", - name = _("Configure Interface") - }, - { - id = "cancel", - name = _("Return to Utilities Menu") - } - }, - datasets = { - { - ip = "", - netmask = "", - default_router = "", - primary_dns = "", - host = "", - domain = "" - } - } - } - - if response.action_id == "ok" then - local ip = response.datasets[1].ip - local netmask = response.datasets[1].netmask - local default_router = response.datasets[1].default_router - local primary_dns = response.datasets[1].primary_dns - local host = response.datasets[1].host - local domain = response.datasets[1].domain - - local cmds = CmdChain.new() - -- XXX check ip for wellformedness first - ni:cmds_assign_inet_addr(cmds, ip) - ni:cmds_assign_netmask(cmds, netmask) - - cmds:add({ - cmdline = "${root}${ROUTE} add default ${default_router}", - replacements = { - default_router = default_router - } - }) - - local success = execute_and_wait_for(ni, cmds) - - -- XXX this isn't quite right, yet... - -- XXX nowhere to write these yet! :) - local rc_conf = ConfigVars.new() - - rc_conf:set( - string.format("ifconfig_%s", ni:get_name()), - string.format("inet %s netmask %s", ip, netmask) - ) - rc_conf:set("defaultrouter", default_router) - - rc_conf:set("hostname", string.format("%s.%s", host, domain)) - - local resolv_conf = ConfigVars.new() - - resolv_conf:set("search", domain) - resolv_conf:set("nameserver", primary_dns) - end -end - -return { - name = "network", - title = "Configure your Network", - action = function(fsm) - local actions, ifname, ni, result - - if not App.state.net_if then - App.state.net_if = NetworkInterfaces.new() - App.state.net_if:probe() - end - - if App.state.net_if:ip_addr_count() > 0 then - return fsm:next() - end - - if not App.ui:confirm(_( - "You have not yet configured your network settings. " .. - "Would you like to do so now? (Having an operational " .. - "network connection will enhance the ability of " .. - "subsequent tasks, such as installing." - )) then - return fsm:next() - end - - ni = App.state.net_if:ui_select_interface() - if not ni then - return fsm:next() - end - - if App.ui:confirm(_( - "Would you like to try dynamically configuring this interface? " .. - "(This requires that you have a DHCP server operating on " .. - "the network that this interface is attached to.)" - )) then - dhcp_configure(ni) - else - static_configure(ni) - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/main.lua deleted file mode 100644 index 03cee51e3f..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/pit/main.lua +++ /dev/null @@ -1,7 +0,0 @@ --- demo/pit/main.lua --- $Id: main.lua,v 1.4 2005/02/24 23:08:04 cpressey Exp $ --- Finite state machine to drive "pre-install tasks" - -require "fsm" - -FSM.auto("language") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/po/dfuibe_lua.pot b/contrib/bsdinstaller-1.1.6/src/backend/lua/po/dfuibe_lua.pot deleted file mode 100644 index 8f195881d7..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/po/dfuibe_lua.pot +++ /dev/null @@ -1,996 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-07 16:44+0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#, c-format -msgid "%d/%d packages were successfully installed!" -msgstr "" - -#, c-format -msgid "%d/%d packages were successfully removed!" -msgstr "" - -#, c-format -msgid "%s is now installed" -msgstr "" - -#, c-format -msgid "%s was not fully installed." -msgstr "" - -#, c-format -msgid "%s will be a plain dir in %s\n" -msgstr "" - -#, c-format -msgid "%s will be symlinked to %s\n" -msgstr "" - -#, c-format -msgid "" -"'%s' is not a recognized partition type. Please use a numeric identifier if " -"you wish to use an unlisted partition type." -msgstr "" - -#, c-format -msgid "" -"'Packet Mode' refers to using newer BIOS calls to boot from a partition of " -"the disk. It is generally not required unless:\n" -"\n" -"- your BIOS does not support legacy mode; or\n" -"- your %s primary partition resides on a cylinder of the disk beyond " -"cylinder 1024; or\n" -"- you just can't get it to boot without it." -msgstr "" - -msgid "" -"A failure occured while provisioning the NetBoot environment. Please " -"consult the log file for details." -msgstr "" - -msgid "Accept and Add User" -msgstr "" - -msgid "Accept and Create" -msgstr "" - -msgid "Accept and Install Bootblocks" -msgstr "" - -msgid "Accept and Set Password" -msgstr "" - -msgid "Accept these Packages" -msgstr "" - -msgid "Action cancelled - no primary partitions were formatted." -msgstr "" - -msgid "Active?" -msgstr "" - -msgid "Add User" -msgstr "" - -msgid "An error occurred when setting the root password." -msgstr "" - -msgid "An error occurred while attempting to set time and date." -msgstr "" - -msgid "Assign IP Address" -msgstr "" - -msgid "Begin Installation" -msgstr "" - -msgid "Begin Installing Files" -msgstr "" - -msgid "Block Size" -msgstr "" - -msgid "Calculating package dependencies." -msgstr "" - -msgid "Cancel" -msgstr "" - -msgid "Capacity" -msgstr "" - -msgid "" -"Capacity must either end in 'M' for megabytes, 'G' for gigabytes, or be '*' " -"to indicate 'use all remaining space.'" -msgstr "" - -msgid "Change Console Settings" -msgstr "" - -msgid "Choose Target System" -msgstr "" - -msgid "Choose one of the following things to configure." -msgstr "" - -msgid "Configure" -msgstr "" - -msgid "Configure Interface" -msgstr "" - -#, c-format -msgid "Configure a %s OS that has already been installed" -msgstr "" - -msgid "Configure a System on Disk" -msgstr "" - -msgid "Configure an Installed System" -msgstr "" - -msgid "Configure the Running System" -msgstr "" - -msgid "Configure the system that was just installed" -msgstr "" - -msgid "Configuring Interface:" -msgstr "" - -#, c-format -msgid "" -"Congratulations, %s is now installed on your hard drive! You may now do one " -"of three things: you can perform some initial configuration of this system, " -"you can reboot to test out your new installation, or you can go back to the " -"main menu and select other actions to perform." -msgstr "" - -msgid "Could not create the skeletal target system." -msgstr "" - -msgid "Could not mount the skeletal target system." -msgstr "" - -msgid "Day" -msgstr "" - -msgid "Default Router" -msgstr "" - -msgid "Disk Drive" -msgstr "" - -msgid "Domain Name" -msgstr "" - -msgid "Edit Partitions" -msgstr "" - -msgid "Enable NetBoot Installation Services" -msgstr "" - -msgid "Enable NetBoot Installation Services?" -msgstr "" - -msgid "English" -msgstr "" - -msgid "" -"Enter a comma-separated list of other groups that this user should belong to" -msgstr "" - -msgid "Enter the IP Address you would like to use" -msgstr "" - -msgid "Enter the IP address of primary DNS Server" -msgstr "" - -msgid "Enter the IP address of the default router" -msgstr "" - -msgid "" -"Enter the current date and time of day to set this computer's internal " -"timekeeping clock." -msgstr "" - -msgid "Enter the current day of month (e.g. `30')" -msgstr "" - -msgid "Enter the current hour (e.g. `07')" -msgstr "" - -msgid "Enter the current minute (e.g. `59')" -msgstr "" - -msgid "Enter the current month (e.g. `07')" -msgstr "" - -msgid "Enter the current year (e.g. `2004')" -msgstr "" - -msgid "Enter the full path to the user's home directory, or leave blank" -msgstr "" - -msgid "Enter the full path to the user's shell program" -msgstr "" - -msgid "Enter the netmask of the IP address" -msgstr "" - -msgid "Enter the primary group for this account, or leave blank" -msgstr "" - -msgid "Enter the real name (or GECOS field) of this user" -msgstr "" - -msgid "Enter the root password you would like to use" -msgstr "" - -msgid "Enter the same password again to confirm" -msgstr "" - -msgid "Enter the user's password (will not be displayed)" -msgstr "" - -msgid "Enter the username the user will log in as" -msgstr "" - -msgid "Enter this account's numeric user id, or leave blank" -msgstr "" - -msgid "" -"Errors occurred while installing packages. Some packages may not have been " -"successfully installed." -msgstr "" - -msgid "Errors occurred; keyboard map was not successfully set." -msgstr "" - -msgid "Errors occurred; screen map was not successfully set." -msgstr "" - -msgid "Errors occurred; video font was not successfully set." -msgstr "" - -#, c-format -msgid "" -"Everything is now ready to install the actual files which comprise the %s " -"operating system on the selected partition of the selected disk.\n" -"\n" -"Note that this process will take quite a while to finish. You may wish to " -"take a break now and come back to the computer in a short while." -msgstr "" - -msgid "Failed to make sure that the partition is bootable." -msgstr "" - -msgid "Format and Partition Disk" -msgstr "" - -msgid "Frag Size" -msgstr "" - -msgid "Full Name of Package" -msgstr "" - -msgid "Group Memberships" -msgstr "" - -msgid "" -"Here you can add a user to an installed system.\n" -"\n" -"You can leave the Home Directory, User ID, and Login Group fields empty if " -"you want these items to be automatically allocated by the system." -msgstr "" - -msgid "Here you can set the super-user (root) password." -msgstr "" - -msgid "Home Directory" -msgstr "" - -msgid "Hostname" -msgstr "" - -msgid "Hour" -msgstr "" - -msgid "IP Address" -msgstr "" - -#, c-format -msgid "Install %s" -msgstr "" - -#, c-format -msgid "Install %s on this computer system" -msgstr "" - -msgid "Install Bootblock(s)" -msgstr "" - -msgid "Install Bootblock?" -msgstr "" - -msgid "Install Packages" -msgstr "" - -msgid "Install a bootblock on this disk" -msgstr "" - -msgid "Install these Packages" -msgstr "" - -msgid "Install?" -msgstr "" - -#, c-format -msgid "" -"Interface\n" -"\n" -"%s\n" -"\n" -"failed to come up." -msgstr "" - -#, c-format -msgid "" -"Interface\n" -"\n" -"%s\n" -"\n" -"is now up, with IP address %s." -msgstr "" - -msgid "" -"Is this machine's internal clock set to local time or UTC (Universal " -"Coordinated Time, roughly the same as Greenwich Mean Time)?\n" -"\n" -"If you don't know, assume local time for now." -msgstr "" - -msgid "Local Time" -msgstr "" - -msgid "Local or UTC (Greenwich Mean Time) clock" -msgstr "" - -msgid "Login Group" -msgstr "" - -msgid "Make this computer a boot server for other machines on the network" -msgstr "" - -msgid "Minute" -msgstr "" - -msgid "Month" -msgstr "" - -msgid "Mountpoint" -msgstr "" - -msgid "" -"NetBoot Installation Services allow this machine to become an Installation " -"Server that will allow other machines on this network to boot as PXE " -"clients, and will start the Installation Environment on them.\n" -"\n" -"*NOTE!* This will assign the IP Address of 10.1.0.1/24 to the selected " -"interface.\n" -"\n" -"Would you like to provision this machine to serve up the Installation " -"Environment to other machines?" -msgstr "" - -msgid "NetBoot installation services are now started." -msgstr "" - -msgid "Netmask" -msgstr "" - -msgid "No thanks" -msgstr "" - -#, c-format -msgid "" -"No valid partitions were found on this disk. You will have to create at " -"least one in which to install %s." -msgstr "" - -msgid "" -"Note: none of the swap subpartitions that you have selected are large enough " -"to hold the contents of memory, and thus cannot be used to hold a crash dump " -"(an image of the computers' memory at the time of failure.) Because this " -"complicates troubleshooting, we recommend that you increase the size of one " -"of your swap subpartitions.\n" -"\n" -"Proceed anyway?" -msgstr "" - -#, c-format -msgid "" -"Note: the total capacity required for the requested subpartitions (%s) does " -"not make full use of the capacity available in the partition (%s.) %d " -"sectors (%s) of space will go unused.\n" -"\n" -"You may wish to expand one or more subpartitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" - -#, c-format -msgid "" -"Note: the total number of sectors needed for the requested partitions (%d) " -"does not make full use of the number of sectors available on the disk (%d.) " -"There will be %d unused sectors (%s.)\n" -"\n" -"You may wish to expand one or more partitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" - -msgid "OK" -msgstr "" - -msgid "Omit Subpartition(s)" -msgstr "" - -#, c-format -msgid "" -"One or more subpartitions of one or more primary partitions of the selected " -"disk are already in use (they are currently mounted on mountpoints in the " -"filesystem.) You should either unmount them before proceeding, or select a " -"different disk to install %s on." -msgstr "" - -#, c-format -msgid "" -"One or more subpartitions on the selected primary partition already in use " -"(they are currently mounted in the filesystem.) You should either unmount " -"them before proceeding, or select a different partition or disk on which to " -"install %s." -msgstr "" - -msgid "Only one partition may have a capacity of '*'." -msgstr "" - -msgid "Only one subpartition may have a capacity of '*'." -msgstr "" - -msgid "Other Group Memberships" -msgstr "" - -msgid "Packet mode?" -msgstr "" - -msgid "Partition Type" -msgstr "" - -msgid "Password" -msgstr "" - -msgid "Password (Again)" -msgstr "" - -msgid "Please choose which installed system you want to configure." -msgstr "" - -msgid "" -"Please enter numbers within acceptable ranges for year, month, day of month, " -"hour, and minute." -msgstr "" - -msgid "Please select the network interface you wish to configure." -msgstr "" - -msgid "Please select your preferred language." -msgstr "" - -msgid "Primary DNS Server" -msgstr "" - -#, c-format -msgid "Primary partition #%d was formatted." -msgstr "" - -#, c-format -msgid "" -"Primary partition #%d was not correctly formatted, and may now be in an " -"inconsistent state. We recommend re-formatting it before proceeding." -msgstr "" - -msgid "Re-enter the user's password to confirm" -msgstr "" - -msgid "Re-type Root Password" -msgstr "" - -msgid "Ready to Install" -msgstr "" - -msgid "Real Name" -msgstr "" - -msgid "Reboot" -msgstr "" - -msgid "Reboot this computer" -msgstr "" - -msgid "Remove Packages" -msgstr "" - -msgid "Remove these Packages" -msgstr "" - -msgid "Remove?" -msgstr "" - -#, c-format -msgid "Return to %s" -msgstr "" - -msgid "Return to Configure Menu" -msgstr "" - -msgid "Return to Create Subpartitions" -msgstr "" - -msgid "Return to Main" -msgstr "" - -msgid "Return to Main Menu" -msgstr "" - -msgid "Return to Previous Menu" -msgstr "" - -msgid "Return to Utilities Menu" -msgstr "" - -msgid "Root Password" -msgstr "" - -msgid "Select All" -msgstr "" - -msgid "Select Component to Configure" -msgstr "" - -msgid "Select Console Font" -msgstr "" - -msgid "Select Keyboard Map" -msgstr "" - -msgid "Select Language" -msgstr "" - -msgid "Select Network Interface" -msgstr "" - -msgid "Select None" -msgstr "" - -msgid "Select Packages" -msgstr "" - -msgid "Select Screen Map" -msgstr "" - -msgid "Select Subpartitions" -msgstr "" - -msgid "Select Time Zone" -msgstr "" - -msgid "Select a Disk" -msgstr "" - -msgid "Select a Partition" -msgstr "" - -msgid "Select a Time Zone appropriate to your physical location." -msgstr "" - -#, c-format -msgid "Select a disk on which to install %s." -msgstr "" - -msgid "Select a disk." -msgstr "" - -msgid "Select a font appropriate to your video monitor and language." -msgstr "" - -msgid "Select a keyboard map appropriate to your keyboard layout." -msgstr "" - -msgid "" -"Select a mapping for translating characters as they appear on your video " -"console screen." -msgstr "" - -msgid "Select a partition." -msgstr "" - -#, c-format -msgid "" -"Select the disk on which the installation of %s that you wish to configure " -"resides." -msgstr "" - -msgid "" -"Select the disk on which the installation that you wish to upgrade resides." -msgstr "" - -msgid "Select the packages you wish to install from the LiveCD onto the HDD." -msgstr "" - -msgid "Select the packages you wish to install." -msgstr "" - -msgid "Select the packages you wish to remove from this system" -msgstr "" - -msgid "" -"Select the partitions (also known as `slices' in BSD tradition) you want to " -"have on this disk.\n" -"\n" -"For Capacity, use 'M' to indicate megabytes, 'G' to indicate gigabytes, or a " -"single '*' to indicate 'use the remaining space on the disk'." -msgstr "" - -#, c-format -msgid "" -"Select the primary partition of %s (also known as a `slice' in the BSD " -"tradition) on which to install %s." -msgstr "" - -#, c-format -msgid "" -"Select the primary partition of %s on which the installation of %s resides." -msgstr "" - -#, c-format -msgid "" -"Select the primary partition of %s on which the installation that you wish " -"to upgrade resides." -msgstr "" - -msgid "Select this to use 'packet mode' to boot the disk" -msgstr "" - -msgid "Set Root Password" -msgstr "" - -msgid "Set Time and Date" -msgstr "" - -msgid "Set Timezone" -msgstr "" - -msgid "Set up NetBoot Server" -msgstr "" - -msgid "" -"Set up the subpartitions (also known as just `partitions' in BSD tradition) " -"you want to have on this primary partition.\n" -"\n" -"For Capacity, use 'M' to indicate megabytes, 'G' to indicate gigabytes, or a " -"single '*' to indicate 'use the remaining space on the primary partition'." -msgstr "" - -#, c-format -msgid "Setting password for user `%s'." -msgstr "" - -msgid "Shell" -msgstr "" - -msgid "Skip this Step" -msgstr "" - -msgid "Softupdates?" -msgstr "" - -#, c-format -msgid "" -"Some situations in which you might not wish to use this installer are:\n" -"\n" -"- you want to install %s onto a logical/extended partition;\n" -"- you want to install %s onto a ``dangerously dedicated'' disk; or\n" -"- you want full and utter control over the install process." -msgstr "" - -#, c-format -msgid "" -"Some subpartitions on the selected primary partition are already activated " -"as swap. Since there is no way to deactivate swap in %s once it is " -"activated, in order to edit the subpartition layout of this primary " -"partition, you must first reboot." -msgstr "" - -#, c-format -msgid "" -"Subpartitions further divide a primary partition for use with %s. Some " -"reasons you may want a set of subpartitions are:\n" -"\n" -"- you want to restrict how much data can be written to certain parts of the " -"primary partition, to quell denial-of-service attacks; and\n" -"- you want to speed up access to data on the disk." -msgstr "" - -msgid "Switch to Expert Mode" -msgstr "" - -msgid "Switch to Normal Mode" -msgstr "" - -msgid "Target system was not successfully upgraded." -msgstr "" - -msgid "Target system was successfully upgraded!" -msgstr "" - -#, c-format -msgid "The Time Zone has been successfully set to %s." -msgstr "" - -msgid "The disk on which you wish to install a bootblock" -msgstr "" - -#, c-format -msgid "" -"The following installed packages require one or more of the packages you " -"selected, and will also be removed:\n" -"\n" -"%s\n" -"Is this acceptable?" -msgstr "" - -#, c-format -msgid "" -"The following packages are required to support the packages you selected, " -"and will also be installed:\n" -"\n" -"%s\n" -"Is this acceptable?" -msgstr "" - -#, c-format -msgid "" -"The installer could not find any disks suitable for installation (IDE or " -"SCSI) attached to this computer. If you wish to install %s on an unorthodox " -"storage device, you will have to exit to a LiveCD command prompt and install " -"it manually, using the file /README as a guide." -msgstr "" - -#, c-format -msgid "" -"The installer could not find any suitable disks attached to this computer. " -"If you wish to configure an installation of %s on an unorthodox storage " -"device, you will have to exit to a LiveCD command prompt and configure it " -"manually, using the file /README as a guide." -msgstr "" - -msgid "" -"The installer could not find any suitable disks attached to this computer. " -"If you wish to upgrade an installation located on an unorthodox storage " -"device, you will have to exit to a LiveCD command prompt and configure it " -"manually, using the file /README as a guide." -msgstr "" - -msgid "The name of the login group contains illegal characters." -msgstr "" - -msgid "The passwords do not match." -msgstr "" - -msgid "The root password has been changed." -msgstr "" - -msgid "The selected shell does not exist on the system." -msgstr "" - -msgid "The target system could not be successfully mounted." -msgstr "" - -msgid "The target system could not be successfully probed." -msgstr "" - -msgid "The text specified in the Real Name field contains illegal characters." -msgstr "" - -msgid "The time and date have successfully been set." -msgstr "" - -msgid "The username contains illegal characters." -msgstr "" - -msgid "There are no packages installed on this system." -msgstr "" - -msgid "" -"There were errors. Some packages may not have been successfully removed." -msgstr "" - -#, c-format -msgid "" -"This experimental application will install %s on one of the hard disk drives " -"attached to this computer. It has been designed to make it easy to install %" -"s in the typical case. If you have special requirements that are not " -"addressed by this installer, or if you have problems using it, you are " -"welcome to install %s manually. To do so select Exit to Live CD, login as " -"root, and follow the instructions given in the file /README .\n" -"\n" -"NOTE! As with any installation process, YOU ARE STRONGLY ENCOURAGED TO BACK " -"UP ANY IMPORTANT DATA ON THIS COMPUTER BEFORE PROCEEDING!" -msgstr "" - -msgid "" -"This machine is about to be shut down. After the machine has reached its " -"shutdown state, you may remove the CD from the CD-ROM drive tray and press " -"Enter to reboot from the HDD." -msgstr "" - -msgid "UTC Time" -msgstr "" - -msgid "Upgrade a system with to the newest available version" -msgstr "" - -msgid "Upgrade an Installed System" -msgstr "" - -msgid "User ID" -msgstr "" - -#, c-format -msgid "User `%s' was added." -msgstr "" - -msgid "User was not successfully added." -msgstr "" - -msgid "Username" -msgstr "" - -#, c-format -msgid "" -"WARNING! ALL data in primary partition #%d,\n" -"\n" -"%s\n" -"\n" -"on the disk\n" -"\n" -"%s\n" -"\n" -" will be IRREVOCABLY ERASED!\n" -"\n" -"Are you ABSOLUTELY SURE you wish to take this action? This is your LAST " -"CHANCE to cancel!" -msgstr "" - -#, c-format -msgid "" -"WARNING: The total number of sectors needed for the requested partitions (%" -"d) exceeds the number of sectors available on the disk (%d) by %d sectors (%" -"s.)\n" -"\n" -"This is an invalid configuration; we recommend shrinking the size of one or " -"more partitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" - -#, c-format -msgid "" -"WARNING: The total number of sectors needed for the requested subpartitions " -"(%d) exceeds the number of sectors available in the partition (%d) by %d " -"sectors (%s.)\n" -"\n" -"This is an invalid configuration; we recommend shrinking the size of one or " -"more subpartitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" - -#, c-format -msgid "" -"WARNING: the %s subpartition should be at least %s in size or you will risk " -"running out of space during the installation.\n" -"\n" -"Proceed anyway?" -msgstr "" - -#, c-format -msgid "" -"WARNING: you should have a disk at least %dM in size, or you may encounter " -"problems trying to install %s." -msgstr "" - -#, c-format -msgid "" -"WARNING: you should have a primary partition at least %dM in size, or you " -"may encounter problems trying to install %s." -msgstr "" - -#, c-format -msgid "Waiting for interface %s to come up." -msgstr "" - -msgid "" -"Warning: already-mounted target system could not be correctly unmounted " -"first." -msgstr "" - -msgid "Warning: subpartitions were not correctly unmounted." -msgstr "" - -msgid "" -"Would you like to try dynamically configuring this interface? (This requires " -"that you have a DHCP server operating on the network that this interface is " -"attached to.)" -msgstr "" - -msgid "Year" -msgstr "" - -#, c-format -msgid "" -"You have elected to not have the following subpartition(s):\n" -"\n" -"%s\n" -"\n" -"The ramifications of these subpartition(s) being missing will be:\n" -"\n" -"%s\n" -"Is this really what you want to do?" -msgstr "" - -msgid "" -"You have not yet configured your network settings. Would you like to do so " -"now? (Having an operational network connection will enhance the ability of " -"subsequent tasks, such as installing." -msgstr "" - -msgid "" -"You may now format and partition this disk if you desire.\n" -"\n" -"If this is a brand new disk, you should do this. If you would like to place " -"multiple operating systems on this disk, you should create multiple " -"partitions, one for each operating system.\n" -"\n" -"If this disk already has operating systems on it that you wish to keep, you " -"should NOT do this, and should skip this step.\n" -"\n" -"Format and partition this disk?" -msgstr "" - -#, c-format -msgid "" -"You may now wish to install bootblocks on one or more disks. If you already " -"have a boot manager installed, you can skip this step (but you may have to " -"configure your boot manager separately.) If you installed %s on a disk " -"other than your first disk, you will need to put the bootblock on at least " -"your first disk and the %s disk." -msgstr "" - -msgid "You must enter a username." -msgstr "" diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/po/ru.po b/contrib/bsdinstaller-1.1.6/src/backend/lua/po/ru.po deleted file mode 100644 index 94b880c17a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/po/ru.po +++ /dev/null @@ -1,1221 +0,0 @@ -# bsdinstaller - Russian language localization. -# Copyright (C) 2004 -# This file is distributed under the same license as the bsdinstaller. -# Denis Peplin , 2004. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-07 16:44+0400\n" -"PO-Revision-Date: 2005-04-07 16:48+0400\n" -"Last-Translator: Denis Peplin \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=koi8-r\n" -"Content-Transfer-Encoding: 8bit\n" - -#, c-format -msgid "%d/%d packages were successfully installed!" -msgstr "%d/%d ÐÁËÅÔÏ× ÂÙÌÏ ÕÓÐÅÛÎÏ ÕÓÔÁÎÏ×ÌÅÎÏ ÎÁ ÄÉÓË!" - -#, c-format -msgid "%d/%d packages were successfully removed!" -msgstr "%d/%d ÐÁËÅÔÏ× ÂÙÌÏ ÕÓÐÅÛÎÏ ÕÄÁÌÅÎÏ!" - -#, c-format -msgid "%s is now installed" -msgstr "%s ÕÓÔÁÎÏ×ÌÅÎÁ" - -#, c-format -msgid "%s was not fully installed." -msgstr "%s ÎÅ ÂÙÌÁ ÐÏÌÎÏÓÔØÀ ÕÓÔÁÎÏ×ÌÅÎÁ." - -#, c-format -msgid "%s will be a plain dir in %s\n" -msgstr "%s ÂÕÄÅÔ ÏÂÙÞÎÙÍ ËÁÔÁÌÏÇÏÍ × %s\n" - -#, c-format -msgid "%s will be symlinked to %s\n" -msgstr "%s ÂÕÄÅÔ ÓÉÍ×ÏÌÉÞÅÓËÏÊ ÓÓÙÌËÏÊ ÎÁ %s\n" - -#, c-format -msgid "" -"'%s' is not a recognized partition type. Please use a numeric identifier if " -"you wish to use an unlisted partition type." -msgstr "" -"'%s' ÎÅ Ñ×ÌÑÅÔÓÑ ÉÚ×ÅÓÔÎÙÍ ÔÉÐÏÍ ÒÁÚÄÅÌÁ. åÓÌÉ ×Ù ÈÏÔÉÔÅ ××ÅÓÔÉ ÎÅ ×ÈÏÄÑÝÉÊ " -"× ÓÐÉÓÏË ÔÉÐ ÒÁÚÄÅÌÁ, ÉÓÐÏÌØÚÕÊÔÅ ÞÉÓÌÏ×ÏÊ ÉÄÅÎÔÉÆÉËÁÔÏÒ." - -#, c-format -msgid "" -"'Packet Mode' refers to using newer BIOS calls to boot from a partition of " -"the disk. It is generally not required unless:\n" -"\n" -"- your BIOS does not support legacy mode; or\n" -"- your %s primary partition resides on a cylinder of the disk beyond " -"cylinder 1024; or\n" -"- you just can't get it to boot without it." -msgstr "" -"'Packet Mode' ÏÚÎÁÞÁÅÔ ÉÓÐÏÌØÚÏ×ÁÎÉÅ ÎÏ×ÙÈ ÆÕÎËÃÉÊ BIOS ÄÌÑ ÚÁÇÒÕÚËÉ Ó " -"ÄÉÓËÏ×ÏÇÏ ÒÁÚÄÅÌÁ. ïÂÙÞÎÏ ÏÎ ÎÅ ÔÒÅÂÕÅÔÓÑ, ÅÓÌÉ ÔÏÌØËÏ:\n" -"\n" -"- BIOS ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ legacy ÒÅÖÉÍ; ÉÌÉ\n" -"- ÏÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ %s ÎÁÈÏÄÉÔÓÑ ÎÁ ÃÉÌÉÎÄÒÅ ÄÉÓËÁ Ó ÎÏÍÅÒÏÍ ÂÏÌØÛÅ " -"1024; ÉÌÉ\n" -"- ×Ù ÐÒÏÓÔÏ ÎÅ ÍÏÖÅÔÅ ÚÁÇÒÕÚÉÔØÓÑ ÂÅÚ ÎÅÇÏ." - -msgid "" -"A failure occured while provisioning the NetBoot environment. Please " -"consult the log file for details." -msgstr "" -"ðÒÉ ÐÏÄÇÏÔÏ×ËÅ NetBoot ÐÒÏÉÚÏÛÌÉ ÏÛÉÂËÉ. ïÂÒÁÔÉÔÅÓØ Ë ÌÏÇ ÆÁÊÌÁÍ ÚÁ " -"ÄÅÔÁÌØÎÏÊ ÉÎÆÏÒÍÁÃÉÅÊ." - -msgid "Accept and Add User" -msgstr "ðÒÉÎÑÔØ É ÄÏÂÁ×ÉÔØ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "Accept and Create" -msgstr "ðÒÉÎÑÔØ É ÓÏÚÄÁÔØ" - -msgid "Accept and Install Bootblocks" -msgstr "ðÏÄÔ×ÅÒÄÉÔØ É ÕÓÔÁÎÏ×ÉÔØ ÚÁÇÒÕÚÏÞÎÙÊ ÂÌÏË" - -msgid "Accept and Set Password" -msgstr "ðÒÉÎÑÔØ É ÕÓÔÁÎÏ×ÉÔØ ÐÁÒÏÌØ" - -msgid "Accept these Packages" -msgstr "ðÒÉÎÑÔØ ÜÔÉ ÐÁËÅÔÙ" - -msgid "Action cancelled - no primary partitions were formatted." -msgstr "äÅÊÓÔ×ÉÅ ÐÒÅÒ×ÁÎÏ - ÎÅÔ ÏÔÆÏÒÍÁÔÉÒÏ×ÁÎÎÙÈ ÏÓÎÏ×ÎÙÈ ÒÁÚÄÅÌÏ×." - -msgid "Active?" -msgstr "áËÔÉ×ÎÏ?" - -msgid "Add User" -msgstr "äÏÂÁ×ÉÔØ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "An error occurred when setting the root password." -msgstr "ðÒÉ ÕÓÔÁÎÏ×ËÅ ÐÁÒÏÌÑ root ÐÒÏÉÚÏÛÌÁ ÏÛÉÂËÁ." - -msgid "An error occurred while attempting to set time and date." -msgstr "ðÒÉ ÐÏÐÙÔËÅ ÕÓÔÁÎÏ×ÉÔØ ×ÒÅÍÑ É ÄÁÔÕ ÐÒÏÉÚÏÛÌÁ ÏÛÉÂËÁ." - -msgid "Assign IP Address" -msgstr "ðÒÉÓ×ÏÅÎÉÅ IP ÁÄÒÅÓÁ" - -msgid "Begin Installation" -msgstr "îÁÞÁÌÏ ÕÓÔÁÎÏ×ËÉ" - -msgid "Begin Installing Files" -msgstr "îÁÞÁÌÏ ÕÓÔÁÎÏ×ËÉ ÆÁÊÌÏ×" - -msgid "Block Size" -msgstr "òÁÚÍÅÒ ÂÌÏËÁ" - -msgid "Calculating package dependencies." -msgstr "ïÐÒÅÄÅÌÅÎÉÅ ÚÁ×ÉÓÉÍÏÓÔÅÊ ÐÁËÅÔÏ×." - -msgid "Cancel" -msgstr "ïÔÍÅÎÁ" - -msgid "Capacity" -msgstr "åÍËÏÓÔØ" - -msgid "" -"Capacity must either end in 'M' for megabytes, 'G' for gigabytes, or be '*' " -"to indicate 'use all remaining space.'" -msgstr "" -"åÍËÏÓÔØ ÍÏÖÅÔ ÓÏÓÔÏÑÔØ ÉÚ ÃÉÆÒÙ É ÂÕË×Ù 'M' ÄÌÑ ÍÅÇÁÂÁÊÔ, 'G' ÄÌÑ ÇÉÇÁÂÁÊÔ, " -" Á '*' ÏÚÎÁÞÁÅÔ 'ÉÓÐÏÌØÚÏ×ÁÔØ ×ÓÅ ÏÓÔÁ×ÛÅÅÓÑ ÍÅÓÔÏ'." - -msgid "Change Console Settings" -msgstr "éÚÍÅÎÅÎÉÅ ÕÓÔÁÎÏ×ÏË ËÏÎÓÏÌÉ" - -msgid "Choose Target System" -msgstr "÷ÙÂÏÒ ÃÅÌÅ×ÏÊ ÓÉÓÔÅÍÙ" - -msgid "Choose one of the following things to configure." -msgstr "÷ÙÂÅÒÉÔÅ ÏÄÉÎ ÉÚ ÓÌÅÄÕÀÝÉÈ ÐÕÎËÔÏ× ÎÁÓÔÒÏÊËÉ." - -msgid "Configure" -msgstr "îÁÓÔÒÏÊËÁ" - -msgid "Configure Interface" -msgstr "îÁÓÔÒÏÊËÁ ÉÎÔÅÒÆÅÊÓÁ" - -#, c-format -msgid "Configure a %s OS that has already been installed" -msgstr "îÁÓÔÒÏÊËÁ ÕÓÔÁÎÏ×ÌÅÎÎÏÊ ïó %s" - -msgid "Configure a System on Disk" -msgstr "îÁÓÔÒÏÊËÁ ÓÉÓÔÅÍÙ ÎÁ ÄÉÓËÅ" - -msgid "Configure an Installed System" -msgstr "îÁÓÔÒÏÊËÁ ÕÓÔÁÎÏ×ÌÅÎÎÏÊ ÓÉÓÔÅÍÙ" - -msgid "Configure the Running System" -msgstr "îÁÓÔÒÏÊËÁ ÒÁÂÏÔÁÀÝÅÊ ÓÉÓÔÅÍÙ" - -msgid "Configure the system that was just installed" -msgstr "îÁÓÔÒÏÊËÁ ÔÏÌØËÏ ÞÔÏ ÕÓÔÁÎÏ×ÌÅÎÎÏÊ ÓÉÓÔÅÍÙ" - -msgid "Configuring Interface:" -msgstr "îÁÓÔÒÏÊËÁ ÉÎÔÅÒÆÅÊÓÁ:" - -#, c-format -msgid "" -"Congratulations, %s is now installed on your hard drive! You may now do one " -"of three things: you can perform some initial configuration of this system, " -"you can reboot to test out your new installation, or you can go back to the " -"main menu and select other actions to perform." -msgstr "" -"ðÏÚÄÒÁ×ÌÑÅÍ, %s ÔÏÌØËÏ ÞÔÏ ÂÙÌÁ ÕÓÔÁÎÏ×ÌÅÎÁ ÎÁ ÖÅÓÔËÉÊ ÄÉÓË! ôÅÐÅÒØ ×Ù ÍÏÖÅÔÅ " -"×ÙÂÒÁÔØ: ×ÙÐÏÌÎÅÎÉÅ ÐÅÒ×ÏÎÁÞÁÌØÎÏÊ ÎÁÓÔÒÏÊËÉ ÓÉÓÔÅÍÙ, ÐÅÒÅÚÁÇÒÕÚËÕ ÄÌÑ " -"ÔÅÓÔÉÒÏ×ÁÎÉÑ ÎÏ×ÏÊ ÕÓÔÁÎÏ×ËÉ, ÉÌÉ ×ÏÚ×ÒÁÔ × ÇÌÁ×ÎÏÅ ÍÅÎÀ ÄÌÑ ×ÙÐÏÌÎÅÎÉÑ " -"ËÁËÉÈ-ÌÉÂÏ ÄÒÕÇÉÈ ÄÅÊÓÔ×ÉÊ." - -msgid "Could not create the skeletal target system." -msgstr "îÅ ÍÏÇÕ ÓÏÚÄÁÔØ ÃÅÌÅ×ÕÀ (skeletal) ÆÁÊÌÏ×ÕÀ ÓÉÓÔÅÍÕ." - -msgid "Could not mount the skeletal target system." -msgstr "îÅ ÍÏÇÕ ÓÍÏÎÔÉÒÏ×ÁÔØ ÃÅÌÅ×ÕÀ (skeletal) ÆÁÊÌÏ×ÕÀ ÓÉÓÔÅÍÕ." - -msgid "Day" -msgstr "äÅÎØ" - -msgid "Default Router" -msgstr "ûÌÀÚ ÐÏ ÕÍÏÌÞÁÎÉÀ" - -msgid "Disk Drive" -msgstr "äÉÓË" - -msgid "Domain Name" -msgstr "éÍÑ ÄÏÍÅÎÁ" - -msgid "Edit Partitions" -msgstr "òÅÄÁËÔÉÒÏ×ÁÎÉÅ ÒÁÚÄÅÌÏ×" - -msgid "Enable NetBoot Installation Services" -msgstr "÷ËÌÀÞÅÎÉÅ ÓÅÒ×ÉÓÏ× ÕÓÔÁÎÏ×ËÉ NetBoot" - -msgid "Enable NetBoot Installation Services?" -msgstr "÷ËÌÀÞÉÔØ ÓÅÒ×ÉÓÙ ÕÓÔÁÎÏ×ËÉ NetBoot?" - -msgid "English" -msgstr "áÎÇÌÉÊÓËÉÊ" - -msgid "" -"Enter a comma-separated list of other groups that this user should belong to" -msgstr "÷×ÅÄÉÔÅ ÒÁÚÄÅÌÅÎÎÙÊ ÚÁÐÑÔÙÍÉ ÓÐÉÓÏË ÄÒÕÇÉÈ ÇÒÕÐÐ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "Enter the IP Address you would like to use" -msgstr "÷×ÅÄÉÔÅ IP ÁÄÒÅÓ, ËÏÔÏÒÙÊ ÂÕÄÅÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ" - -msgid "Enter the IP address of primary DNS Server" -msgstr "÷×ÅÄÉÔÅ IP ÁÄÒÅÓ ÐÅÒ×ÉÞÎÏÇÏ DNS ÓÅÒ×ÅÒÁ" - -msgid "Enter the IP address of the default router" -msgstr "÷×ÅÄÉÔÅ IP ÁÄÒÅÓ ÛÌÀÚÁ ÐÏ ÕÍÏÌÞÁÎÉÀ" - -msgid "" -"Enter the current date and time of day to set this computer's internal " -"timekeeping clock." -msgstr "" -"÷×ÅÄÉÔÅ ÔÅËÕÝÉÅ ÄÁÔÕ É ×ÒÅÍÑ, ÞÔÏÂÙ ÕÓÔÁÎÏ×ÉÔØ ×ÎÕÔÒÅÎÎÉÅ ÞÁÓÙ " -"ËÏÍÐØÀÔÅÒÁ." - -msgid "Enter the current day of month (e.g. `30')" -msgstr "÷×ÅÄÉÔÅ ÄÅÎØ (ÎÁÐÒÉÍÅÒ, `30')" - -msgid "Enter the current hour (e.g. `07')" -msgstr "÷×ÅÄÉÔÅ ÞÁÓ (ÎÁÐÒÉÍÅÒ, `07')" - -msgid "Enter the current minute (e.g. `59')" -msgstr "÷×ÅÄÉÔÅ ÍÉÎÕÔÕ (ÎÁÐÒÉÍÅÒ, `59')" - -msgid "Enter the current month (e.g. `07')" -msgstr "÷×ÅÄÉÔÅ ÍÅÓÑà (ÎÁÐÒÉÍÅÒ, `07')" - -msgid "Enter the current year (e.g. `2004')" -msgstr "÷×ÅÄÉÔÅ ÇÏÄ (ÎÁÐÒÉÍÅÒ, `2004')" - -msgid "Enter the full path to the user's home directory, or leave blank" -msgstr "" -"÷×ÅÄÉÔÅ ÐÏÌÎÙÊ ÐÕÔØ Ë ÄÏÍÁÛÎÅÍÕ ËÁÔÁÌÏÇÕ ÐÏÌØÚÏ×ÁÔÅÌÑ ÉÌÉ ÏÓÔÁ×ØÔÅ ÐÏÌÅ " -"ÐÕÓÔÙÍ" - -msgid "Enter the full path to the user's shell program" -msgstr "÷×ÅÄÉÔÅ ÐÏÌÎÙÊ ÐÕÔØ Ë ÏÂÏÌÏÞËÅ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "Enter the netmask of the IP address" -msgstr "÷×ÅÄÉÔÅ ÓÅÔÅ×ÕÀ ÍÁÓËÕ ÄÌÑ IP ÁÄÒÅÓÁ" - -msgid "Enter the primary group for this account, or leave blank" -msgstr "÷×ÅÄÉÔÅ ÏÓÎÏ×ÎÕÀ ÇÒÕÐÐÕ ÜÔÏÊ ÕÞÅÔÎÏÊ ÚÁÐÉÓÉ ÉÌÉ ÏÓÔÁ×ØÔÅ ÐÏÌÅ ÐÕÓÔÙÍ" - -msgid "Enter the real name (or GECOS field) of this user" -msgstr "÷×ÅÄÉÔÅ ÐÏÌÎÏÅ ÉÍÑ (ÉÌÉ ÐÏÌÅ GECOS) ÜÔÏÇÏ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "Enter the root password you would like to use" -msgstr "÷×ÅÄÉÔÅ ÐÁÒÏÌØ root" - -msgid "Enter the same password again to confirm" -msgstr "÷×ÅÄÉÔÅ ÔÏÔ ÖÅ ÐÁÒÏÌØ ÅÝÅ ÒÁÚ ÄÌÑ ÐÏÄÔ×ÅÒÖÄÅÎÉÑ" - -msgid "Enter the user's password (will not be displayed)" -msgstr "÷×ÅÄÉÔÅ ÐÁÒÏÌØ ÐÏÌØÚÏ×ÁÔÅÌÑ (ÎÅ ÂÕÄÅÔ ÏÔÏÂÒÁÖÁÔØÓÑ)" - -msgid "Enter the username the user will log in as" -msgstr "÷×ÅÄÉÔÅ ÉÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -msgid "Enter this account's numeric user id, or leave blank" -msgstr "" -"÷×ÅÄÉÔÅ ÞÉÓÌÏ×ÏÊ ÉÄÅÎÔÉÆÉËÁÔÏÒ ÜÔÏÊ ÕÞÅÔÎÏÊ ÚÁÐÉÓÉ ÉÌÉ ÏÓÔÁ×ØÔÅ ÐÏÌÅ ÐÕÓÔÙÍ" - -msgid "" -"Errors occurred while installing packages. Some packages may not have been " -"successfully installed." -msgstr "" -"ðÒÉ ÕÓÔÁÎÏ×ËÅ ÐÁËÅÔÏ× ×ÏÚÎÉËÌÉ ÏÛÉÂËÉ. îÅËÏÔÏÒÙÅ ÐÁËÅÔÙ ÍÏÇÌÉ ÂÙÔØ ÎÅ " -"ÕÓÔÁÎÏ×ÌÅÎÙ." - -msgid "Errors occurred; keyboard map was not successfully set." -msgstr "÷ÏÚÎÉËÌÉ ÏÛÉÂËÉ; ÒÁÓËÌÁÄËÁ ËÌÁ×ÉÁÔÕÒÙ ÎÅ ÂÙÌÁ ÕÓÔÁÎÏ×ÌÅÎÁ." - -msgid "Errors occurred; screen map was not successfully set." -msgstr "÷ÏÚÎÉËÌÉ ÏÛÉÂËÉ; ÐÁÒÁÍÅÔÒÙ ÜËÒÁÎÁ ÎÅ ÂÙÌÉ ÕÓÔÁÎÏ×ÌÅÎÙ." - -msgid "Errors occurred; video font was not successfully set." -msgstr "÷ÏÚÎÉËÌÉ ÏÛÉÂËÉ; ×ÉÄÅÏ ÛÒÉÆÔ ÎÅ ÂÙÌ ÕÓÔÁÎÏ×ÌÅÎ." - -#, c-format -msgid "" -"Everything is now ready to install the actual files which comprise the %s " -"operating system on the selected partition of the selected disk.\n" -"\n" -"Note that this process will take quite a while to finish. You may wish to " -"take a break now and come back to the computer in a short while." -msgstr "" -"÷ÓÅ ÇÏÔÏ×Ï Ë ÕÓÔÁÎÏ×ËÅ ÆÁÊÌÏ× %s ÎÁ ×ÙÂÒÁÎÎÙÊ ÒÁÚÄÅÌ ×ÙÂÒÁÎÎÏÇÏ ÄÉÓËÁ.\n" -"\n" -"üÔÏÍÕ ÐÒÏÃÅÓÓÕ ÐÏÔÒÅÂÕÅÔÓÑ ÎÅËÏÔÏÒÏÅ ×ÒÅÍÑ. ÷Ù ÍÏÖÅÔÅ ÓÄÅÌÁÔØ ÐÅÒÅÒÙ× É " -"×ÅÒÎÕÔØÓÑ Ë ËÏÍÐØÀÔÅÒÕ ÞÅÒÅÚ ÎÅËÏÔÏÒÏÅ ×ÒÅÍÑ." - -msgid "Failed to make sure that the partition is bootable." -msgstr "îÅ ÕÄÁÌÏÓØ ÐÒÏ×ÅÒÉÔØ, ÚÁÇÒÕÖÁÅÍ ÌÉ ÒÁÚÄÅÌ." - -msgid "Format and Partition Disk" -msgstr "æÏÒÍÁÔÉÒÏ×ÁÎÉÅ É ÒÁÚÂÉÅÎÉÅ ÄÉÓËÁ ÎÁ ÒÁÚÄÅÌÙ" - -msgid "Frag Size" -msgstr "òÁÚÍÅÒ ÆÒÁÇÍÅÎÔÁ" - -msgid "Full Name of Package" -msgstr "ðÏÌÎÏÅ ÉÍÑ ÐÁËÅÔÁ" - -msgid "Group Memberships" -msgstr "ðÒÉÎÁÄÌÅÖÎÏÓÔØ ÇÒÕÐÐÁÍ" - -msgid "" -"Here you can add a user to an installed system.\n" -"\n" -"You can leave the Home Directory, User ID, and Login Group fields empty if " -"you want these items to be automatically allocated by the system." -msgstr "" -"úÄÅÓØ ×Ù ÍÏÖÅÔÅ ÄÏÂÁ×ÉÔØ ÐÏÌØÚÏ×ÁÔÅÌÑ × ÕÓÔÁÎÏ×ÌÅÎÎÕÀ ÓÉÓÔÅÍÕ.\n" -"\n" -"÷Ù ÍÏÖÅÔÅ ÏÓÔÁ×ÉÔØ ÐÏÌÑ 'äÏÍÁÛÎÉÊ ËÁÔÁÌÏÇ', 'ID ÐÏÌØÚÏ×ÁÔÅÌÑ' É 'çÒÕÐÐÁ' " -"ÐÕÓÔÙÍÉ, ÅÓÌÉ ÈÏÔÉÔÅ, ÞÔÏÂÙ ÜÔÉ ÚÎÁÞÅÎÉÑ ÂÙÌÉ Á×ÔÏÍÁÔÉÞÅÓËÉ ×ÙÄÅÌÅÎÙ " -"ÓÉÓÔÅÍÏÊ." - -msgid "Here you can set the super-user (root) password." -msgstr "úÄÅÓØ ×Ù ÍÏÖÅÔÅ ÕÓÔÁÎÏ×ÉÔØ ÐÁÒÏÌØ ÓÕÐÅÒÐÏÌØÚÏ×ÁÔÅÌÑ (root)." - -msgid "Home Directory" -msgstr "äÏÍÁÛÎÉÊ ËÁÔÁÌÏÇ" - -msgid "Hostname" -msgstr "éÍÑ ÈÏÓÔÁ" - -msgid "Hour" -msgstr "þÁÓ" - -msgid "IP Address" -msgstr "IP ÁÄÒÅÓ" - -#, c-format -msgid "Install %s" -msgstr "õÓÔÁÎÏ×ËÁ %s" - -#, c-format -msgid "Install %s on this computer system" -msgstr "õÓÔÁÎÏ×ËÁ %s ÎÁ ÜÔÏÔ ËÏÍÐØÀÔÅÒ" - -msgid "Install Bootblock(s)" -msgstr "õÓÔÁÎÏ×ËÁ ÚÁÇÒÕÚÏÞÎÙÈ ÂÌÏËÏ×" - -msgid "Install Bootblock?" -msgstr "õÓÔÁÎÏ×ÉÔØ ÚÁÇÒÕÚÏÞÎÙÊ ÂÌÏË?" - -msgid "Install Packages" -msgstr "õÓÔÁÎÏ×ËÁ ÐÁËÅÔÏ×" - -msgid "Install a bootblock on this disk" -msgstr "õÓÔÁÎÏ×ËÁ ÚÁÇÒÕÚÏÞÎÏÇÏ ÂÌÏËÁ ÎÁ ÄÉÓË" - -msgid "Install these Packages" -msgstr "õÓÔÁÎÏ×ËÁ ÐÁËÅÔÏ×" - -msgid "Install?" -msgstr "õÓÔÁÎÏ×ÉÔØ?" - -#, c-format -msgid "" -"Interface\n" -"\n" -"%s\n" -"\n" -"failed to come up." -msgstr "" -"éÎÔÅÒÆÅÊÓ\n" -"\n" -"%s\n" -"\n" -"ÐÏÄÎÑÔØ ÎÅ ÕÄÁÌÏÓØ." - -#, c-format -msgid "" -"Interface\n" -"\n" -"%s\n" -"\n" -"is now up, with IP address %s." -msgstr "" -"éÎÔÅÒÆÅÊÓ\n" -"\n" -"%s\n" -"\n" -"ÐÏÄÎÑÔ, IP ÁÄÒÅÓ %s." - -msgid "" -"Is this machine's internal clock set to local time or UTC (Universal " -"Coordinated Time, roughly the same as Greenwich Mean Time)?\n" -"\n" -"If you don't know, assume local time for now." -msgstr "" -"õÓÔÁÎÏ×ÌÅÎÙ ÌÉ ÞÁÓÙ ÜÔÏÇÏ ËÏÍÐØÀÔÅÒÁ × ÌÏËÁÌØÎÏÅ ×ÒÅÍÑ, ÉÌÉ × UTC " -"(Universal Coordinated Time, ÐÒÉÍÅÒÎÏ ÔÏ ÖÅ, ÞÔÏ É Greenwich Mean Time)?\n" -"\n" -"åÓÌÉ ×Ù ÎÅ ÚÎÁÅÔÅ, ×ÙÂÅÒÉÔÅ ÌÏËÁÌØÎÏÅ ×ÒÅÍÑ." - -msgid "Local Time" -msgstr "ìÏËÁÌØÎÏÅ ×ÒÅÍÑ" - -msgid "Local or UTC (Greenwich Mean Time) clock" -msgstr "ìÏËÁÌØÎÙÅ ÉÌÉ UTC (Greenwich Mean Time) ÞÁÓÙ" - -msgid "Login Group" -msgstr "çÒÕÐÐÁ" - -msgid "Make this computer a boot server for other machines on the network" -msgstr "óÄÅÌÁÔØ ÜÔÏÔ ËÏÍÐØÀÔÅÒ ÚÁÇÒÕÚÏÞÎÙÍ ÓÅÒ×ÅÒÏÍ ÄÌÑ ÄÒÕÇÉÈ ËÏÍÐØÀÔÅÒÏ× × ÓÅÔÉ" - -msgid "Minute" -msgstr "íÉÎÕÔÁ" - -msgid "Month" -msgstr "íÅÓÑÃ" - -msgid "Mountpoint" -msgstr "ôÏÞËÁ ÍÏÎÔÉÒÏ×ÁÎÉÑ" - -msgid "" -"NetBoot Installation Services allow this machine to become an Installation " -"Server that will allow other machines on this network to boot as PXE " -"clients, and will start the Installation Environment on them.\n" -"\n" -"*NOTE!* This will assign the IP Address of 10.1.0.1/24 to the selected " -"interface.\n" -"\n" -"Would you like to provision this machine to serve up the Installation " -"Environment to other machines?" -msgstr "" -"óÅÒ×ÉÓÙ ÕÓÔÁÎÏ×ËÉ NetBoot ÐÏÚ×ÏÌÑÀÔ ÜÔÏÍÕ ËÏÍÐØÀÔÅÒÕ ÓÔÁÔØ ÓÅÒ×ÅÒÏÍ " -"ÕÓÔÁÎÏ×ËÉ, ÞÔÏ ÐÏÚ×ÏÌÉÔØ ÄÒÕÇÉÍ ËÏÍÐØÀÔÅÒÁÍ × ÜÔÏÊ ÓÅÔÉ ÚÁÇÒÕÖÁÔØÓÑ " -" × ËÁÞÅÓÔ×Å PXE ËÌÉÅÎÔÏ×, É ÚÁÐÕÓËÁÔØ ÎÁ ÎÉÈ ÓÒÅÄÕ ÕÓÔÁÎÏ×ËÉ.\n" -"\n" -"*÷îéíáîéå!* ÷ÙÂÒÁÎÎÏÍÕ ÉÎÔÅÒÆÅÊÓÕ ÂÕÄÅÔ ÐÒÉÓ×ÏÅÎ IP ÁÄÒÅÓ 10.1.0.1/24.\n" -"\n" -"èÏÔÉÔÅ ÌÉ ×Ù ÓÄÅÌÁÔØ ÜÔÏÔ ËÏÍÐØÀÔÅÒ ÐÒÏ×ÁÊÄÅÒÏÍ ÓÒÅÄÙ ÕÓÔÁÎÏ×ËÉ ÄÌÑ ÄÒÕÇÉÈ " -"ËÏÍÐØÀÔÅÒÏ×?" - -msgid "NetBoot installation services are now started." -msgstr "NetBoot ÓÅÒ×ÉÓ ÕÓÔÁÎÏ×ËÉ ÂÙÌ ÚÁÐÕÝÅÎ." - -msgid "Netmask" -msgstr "óÅÔÅ×ÁÑ ÍÁÓËÁ" - -msgid "No thanks" -msgstr "îÅÔ, ÓÐÁÓÉÂÏ" - -#, c-format -msgid "" -"No valid partitions were found on this disk. You will have to create at " -"least one in which to install %s." -msgstr "" -"îÁ ÜÔÏÍ ÄÉÓËÅ ÎÁ ÂÙÌÏ ÎÁÊÄÅÎÏ ÎÉ ÏÄÎÏÇÏ ÐÏÄÈÏÄÑÝÅÇÏ ÒÁÚÄÅÌÁ. äÌÑ ÕÓÔÁÎÏ×ËÉ " -"%s ÐÏÔÒÅÂÕÅÔÓÑ ÓÏÚÄÁÔØ ÈÏÔÑ ÂÙ ÏÄÉÎ ÒÁÚÄÅÌ." - -msgid "" -"Note: none of the swap subpartitions that you have selected are large enough " -"to hold the contents of memory, and thus cannot be used to hold a crash dump " -"(an image of the computers' memory at the time of failure.) Because this " -"complicates troubleshooting, we recommend that you increase the size of one " -"of your swap subpartitions.\n" -"\n" -"Proceed anyway?" -msgstr "" -"÷ÎÉÍÁÎÉÅ: ÎÅÔ ÎÉ ÏÄÎÏÇÏ ÄÏÓÔÁÔÏÞÎÏ ÂÏÌØÛÏÇÏ ÒÁÚÄÅÌÁ ÐÏÄËÁÞËÉ, ÞÔÏÂÙ ÓÏÈÒÁÎÉÔØ " -"ÓÏÄÅÒÖÉÍÏÅ ÐÁÍÑÔÉ, É ÓÌÅÄÏ×ÁÔÅÌØÎÏ ÉÈ ÎÅÌØÚÑ ÉÓÐÏÌØÚÏ×ÁÔØ ÄÌÑ ÓÏÈÒÁÎÅÎÉÑ " -"ËÒÜÛ ÄÁÍÐÁ (ÏÂÒÁÚÁ ÐÁÍÑÔÉ ×Ï ×ÒÅÍÑ ÓÂÏÑ). ðÏÓËÏÌØËÕ ÜÔÏ ÕÓÌÏÖÎÉÔ ÒÅÛÅÎÉÅ " -"ÐÒÏÂÌÅÍ, ÍÙ ÒÅËÏÍÅÎÄÕÅÍ Õ×ÅÌÉÞÉÔØ ÒÁÚÍÅÒ ÒÁÚÄÅÌÏ× ÐÏÄËÁÞËÉ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -#, c-format -msgid "" -"Note: the total capacity required for the requested subpartitions (%s) does " -"not make full use of the capacity available in the partition (%s.) %d " -"sectors (%s) of space will go unused.\n" -"\n" -"You may wish to expand one or more subpartitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" -"÷ÎÉÍÁÎÉÅ: ÏÂÝÉÊ ÒÁÚÍÅÒ, ×ÙÄÅÌÑÅÍÙÊ ÐÏÄ ÓÏÚÄÁ×ÁÅÍÙÅ ÐÏÄÒÁÚÄÅÌÙ (%s), ÍÅÎØÛÅ " -"ÏÂÝÅÇÏ ÒÁÚÍÅÒÁ, ÄÏÓÔÕÐÎÏÇÏ × ÒÁÚÄÅÌÅ (%s). %d ÓÅËÔÏÒÏ× (%s) " -"ÎÅ ÉÓÐÏÌØÚÕÀÔÓÑ.\n" -"\n" -"÷Ù ÍÏÖÅÔÅ Õ×ÅÌÉÞÉÔØ ÏÄÉÎ ÉÌÉ ÂÏÌÅÅ ÐÏÄÒÁÚÄÅÌÏ× ÐÅÒÅÄ ÕÓÔÁÎÏ×ËÏÊ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -#, c-format -msgid "" -"Note: the total number of sectors needed for the requested partitions (%d) " -"does not make full use of the number of sectors available on the disk (%d.) " -"There will be %d unused sectors (%s.)\n" -"\n" -"You may wish to expand one or more partitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" -"÷ÎÉÍÁÎÉÅ: ÏÂÝÅÅ ËÏÌÉÞÅÓÔ×Ï ÓÅËÔÏÒÏ×, ×ÙÄÅÌÑÅÍÙÈ ÐÏÄ ÓÏÚÄÁ×ÁÅÍÙÅ ÒÁÚÄÅÌÙ (%d), " -"ÍÅÎØÛÅ ÏÂÝÅÇÏ ËÏÌÉÞÅÓÔ×Á ÓÅËÔÏÒÏ×, ÄÏÓÔÕÐÎÙÈ ÎÁ ÄÉÓËÅ (%d). %d ÓÅËÔÏÒÏ× ÎÅ " -"ÉÓÐÏÌØÚÕÅÔÓÑ (%s).\n" -"\n" -"÷Ù ÍÏÖÅÔÅ Õ×ÅÌÉÞÉÔØ ÏÄÉÎ ÉÌÉ ÂÏÌÅÅ ÒÁÚÄÅÌÏ× ÐÅÒÅÄ ÕÓÔÁÎÏ×ËÏÊ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -msgid "OK" -msgstr "OK" - -msgid "Omit Subpartition(s)" -msgstr "ðÒÏÐÕÓÔÉÔØ ÐÏÄÒÁÚÄÅÌ(Ù)" - -#, c-format -msgid "" -"One or more subpartitions of one or more primary partitions of the selected " -"disk are already in use (they are currently mounted on mountpoints in the " -"filesystem.) You should either unmount them before proceeding, or select a " -"different disk to install %s on." -msgstr "" -"ïÄÉÎ ÉÌÉ ÂÏÌÅÅ ÐÏÄÒÁÚÄÅÌÏ× ÎÁ ÏÄÎÏÍ ÉÌÉ ÂÏÌÅÅ ÐÅÒ×ÉÞÎÙÈ ÒÁÚÄÅÌÏ× ×ÙÂÒÁÎÎÏÇÏ " -"ÄÉÓËÁ ÕÖÅ ÉÓÐÏÌØÚÕÀÔÓÑ (ÏÎÉ ÓÍÏÎÔÉÒÏ×ÁÎÙ ÎÁ ÔÏÞËÉ ÍÏÎÔÉÒÏ×ÁÎÉÑ ÆÁÊÌÏ×ÏÊ " -"ÓÉÓÔÅÍÙ). ÷Ù ÄÏÌÖÎÙ ÉÌÉ ÒÁÚÍÏÎÔÉÒÏ×ÁÔØ ÉÈ ÐÅÒÅÄ ÐÒÏÄÏÌÖÅÎÉÅÍ, ÉÌÉ ×ÙÂÒÁÔØ ÄÌÑ " -"ÄÒÕÇÏÊ ÄÉÓË ÄÌÑ ÕÓÔÁÎÏ×ËÉ %s." - -#, c-format -msgid "" -"One or more subpartitions on the selected primary partition already in use " -"(they are currently mounted in the filesystem.) You should either unmount " -"them before proceeding, or select a different partition or disk on which to " -"install %s." -msgstr "" -"ïÄÉÎ ÉÌÉ ÂÏÌÅÅ ÐÏÄÒÁÚÄÅÌÏ× ÎÁ ×ÙÂÒÁÎÎÏÍ ÐÅÒ×ÉÞÎÏÍ ÒÁÚÄÅÌÅ ÕÖÅ ÉÓÐÏÌØÚÕÀÔÓÑ " -"(ÏÎÉ ÓÅÊÞÁÓ ÓÍÏÎÔÉÒÏ×ÁÎÙ × ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÅ). ÷Ù ÄÏÌÖÎÙ ÉÌÉ ÒÁÚÍÏÎÔÉÒÏ×ÁÔØ ÉÈ " -"ÐÅÒÅÄ ÐÒÏÄÏÌÖÅÎÉÅÍ, ÉÌÉ ×ÙÂÒÁÔØ ÄÒÕÇÏÊ ÒÁÚÄÅÌ ÄÉÓËÁ ÄÌÑ ÕÓÔÁÎÏ×ËÉ %s." - -msgid "Only one partition may have a capacity of '*'." -msgstr "ôÏÌØËÏ ÄÌÑ ÏÄÎÏÇÏ ÒÁÚÄÅÌÁ ÍÏÖÅÔ ÂÙÔØ ÕËÁÚÁÎ ÏÂßÅÍ '*'." - -msgid "Only one subpartition may have a capacity of '*'." -msgstr "ôÏÌØËÏ ÄÌÑ ÏÄÎÏÇÏ ÐÏÄÒÁÚÄÅÌÁ ÍÏÖÅÔ ÂÙÔØ ÕËÁÚÁÎ ÏÂßÅÍ '*'." - -msgid "Other Group Memberships" -msgstr "äÒÕÇÉÅ ÇÒÕÐÐÙ" - -msgid "Packet mode?" -msgstr "ðÁËÅÔÎÙÊ ÒÅÖÉÍ?" - -msgid "Partition Type" -msgstr "ôÉÐ ÒÁÚÄÅÌÁ" - -msgid "Password" -msgstr "ðÁÒÏÌØ" - -msgid "Password (Again)" -msgstr "ðÁÒÏÌØ (ÐÏ×ÔÏÒ)" - -msgid "Please choose which installed system you want to configure." -msgstr "÷ÙÂÅÒÉÔÅ, ËÁËÕÀ ÕÓÔÁÎÏ×ÌÅÎÎÕÀ ÓÉÓÔÅÍÕ ×Ù ÈÏÔÉÔÅ ÎÁÓÔÒÏÉÔØ." - -msgid "" -"Please enter numbers within acceptable ranges for year, month, day of month, " -"hour, and minute." -msgstr "" -"ðÏÖÁÌÕÊÓÔÁ, ××ÅÄÉÔÅ ÞÉÓÌÁ, ×ÈÏÄÑÝÉÅ × ÄÉÁÐÁÚÏÎÙ ÇÏÄÁ, ÍÅÓÑÃÁ, ÄÎÑ ÍÅÓÑÃÁ, " -"ÞÁÓÁ É ÍÉÎÕÔÙ." - -msgid "Please select the network interface you wish to configure." -msgstr "÷ÙÂÅÒÉÔÅ, ËÁËÏÊ ÓÅÔÅ×ÏÊ ÉÎÔÅÒÆÅÊÓ ×Ù ÈÏÔÉÔÅ ÎÁÓÔÒÏÉÔØ." - -msgid "Please select your preferred language." -msgstr "÷ÙÂÅÒÉÔÅ ÐÒÅÄÐÏÞÉÔÁÅÍÙÊ ÑÚÙË." - -msgid "Primary DNS Server" -msgstr "ðÅÒ×ÉÞÎÙÊ DNS ÓÅÒ×ÅÒ" - -#, c-format -msgid "Primary partition #%d was formatted." -msgstr "ïÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ #%d ÂÙÌ ÏÔÆÏÒÍÁÔÉÒÏ×ÁÎ." - -#, c-format -msgid "" -"Primary partition #%d was not correctly formatted, and may now be in an " -"inconsistent state. We recommend re-formatting it before proceeding." -msgstr "" -"ïÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ #%d ÎÅ ÂÙÌ ËÏÒÒÅËÔÎÏ ÏÔÆÏÒÍÁÔÉÒÏ×ÁÎ, É ÍÏÖÅÔ ÎÁÈÏÄÉÔØÓÑ × " -"ÐÏ×ÒÅÖÄÅÎÎÏÍ ÓÏÓÔÏÑÎÉÉ. òÅËÏÍÅÎÄÕÅÔÓÑ ÐÅÒÅÆÏÒÍÁÔÉÒÏ×ÁÔØ ÅÇÏ ÐÅÒÅÄ " -"ÄÁÌØÎÅÊÛÉÍÉ ÄÅÊÓÔ×ÉÑÍÉ." - -msgid "Re-enter the user's password to confirm" -msgstr "÷×ÅÄÉÔÅ ÐÁÒÏÌØ ÅÝÅ ÒÁÚ ÄÌÑ ÐÏÄÔ×ÅÒÖÄÅÎÉÑ" - -msgid "Re-type Root Password" -msgstr "÷×ÅÄÉÔÅ ÐÁÒÏÌØ root ÅÝÅ ÒÁÚ" - -msgid "Ready to Install" -msgstr "÷ÓÅ ÇÏÔÏ×Ï Ë ÕÓÔÁÎÏ×ËÅ" - -msgid "Real Name" -msgstr "ðÏÌÎÏÅ ÉÍÑ" - -msgid "Reboot" -msgstr "ðÅÒÅÚÁÇÒÕÚËÁ" - -msgid "Reboot this computer" -msgstr "ðÅÒÅÚÁÇÒÕÚËÁ ËÏÍÐØÀÔÅÒÁ" - -msgid "Remove Packages" -msgstr "õÄÁÌÅÎÉÅ ÐÁËÅÔÏ×" - -msgid "Remove these Packages" -msgstr "õÄÁÌÅÎÉÅ ×ÙÂÒÁÎÎÙÈ ÐÁËÅÔÏ×" - -msgid "Remove?" -msgstr "õÄÁÌÉÔØ?" - -#, c-format -msgid "Return to %s" -msgstr "÷ÏÚ×ÒÁÔ × %s" - -msgid "Return to Configure Menu" -msgstr "÷ÏÚ×ÒÁÔ × ÍÅÎÀ ÎÁÓÔÒÏÊËÉ" - -msgid "Return to Create Subpartitions" -msgstr "÷ÏÚ×ÒÁÔ Ë ÓÏÚÄÁÎÉÀ ÐÏÄÒÁÚÄÅÌÏ×" - -msgid "Return to Main" -msgstr "÷ÏÚ×ÒÁÔ × ÎÁÞÁÌÏ" - -msgid "Return to Main Menu" -msgstr "÷ÏÚ×ÒÁÔ × ÇÌÁ×ÎÏÅ ÍÅÎÀ" - -msgid "Return to Previous Menu" -msgstr "÷ÏÚ×ÒÁÔ × ÐÒÅÄÙÄÕÝÅÅ ÍÅÎÀ" - -msgid "Return to Utilities Menu" -msgstr "÷ÏÚ×ÒÁÔ × ÍÅÎÀ ÕÔÉÌÉÔ" - -msgid "Root Password" -msgstr "ðÁÒÏÌØ root" - -msgid "Select All" -msgstr "÷ÙÂÒÁÔØ ×ÓÅ" - -msgid "Select Component to Configure" -msgstr "÷ÙÂÏÒ ËÏÍÐÏÎÅÎÔÁ ÄÌÑ ÎÁÓÔÒÏÊËÉ" - -msgid "Select Console Font" -msgstr "÷ÙÂÏÒ ËÏÎÓÏÌØÎÏÇÏ ÛÒÉÆÔÁ" - -msgid "Select Keyboard Map" -msgstr "÷ÙÂÏÒ ÒÁÓËÌÁÄËÉ ËÌÁ×ÉÁÔÕÒÙ" - -msgid "Select Language" -msgstr "÷ÙÂÏÒ ÑÚÙËÁ" - -msgid "Select Network Interface" -msgstr "÷ÙÂÏÒ ÓÅÔÅ×ÏÇÏ ÉÎÔÅÒÆÅÊÓÁ" - -msgid "Select None" -msgstr "îÅ ×ÙÂÉÒÁÔØ ÎÉÞÅÇÏ" - -msgid "Select Packages" -msgstr "÷ÙÂÏÒ ÐÁËÅÔÏ×" - -msgid "Select Screen Map" -msgstr "÷ÙÂÏÒ ËÁÒÔÙ ÜËÒÁÎÁ" - -msgid "Select Subpartitions" -msgstr "÷ÙÂÏÒ ÐÏÄÒÁÚÄÅÌÏ×" - -msgid "Select Time Zone" -msgstr "÷ÙÂÏÒ ×ÒÅÍÅÎÎÏÊ ÚÏÎÙ" - -msgid "Select a Disk" -msgstr "÷ÙÂÏÒ ÄÉÓËÁ" - -msgid "Select a Partition" -msgstr "÷ÙÂÏÒ ÒÁÚÄÅÌÁ" - -msgid "Select a Time Zone appropriate to your physical location." -msgstr "÷ÙÂÅÒÉÔÅ ×ÒÅÍÅÎÎÕÀ ÚÏÎÕ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÕÀ ×ÁÛÅÍÕ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÀ" - -#, c-format -msgid "Select a disk on which to install %s." -msgstr "÷ÙÂÏÒ ÄÉÓËÁ ÄÌÑ ÕÓÔÁÎÏ×ËÉ %s." - -msgid "Select a disk." -msgstr "÷ÙÂÏÒ ÄÉÓËÁ." - -msgid "Select a font appropriate to your video monitor and language." -msgstr "÷ÙÂÅÒÉÔÅ ÛÒÉÆÔ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÊ ×ÁÛÅÍÕ ÍÏÎÉÔÏÒÕ É ÑÚÙËÕ." - -msgid "Select a keyboard map appropriate to your keyboard layout." -msgstr "÷ÙÂÅÒÉÔÅ ÒÁÓËÌÁÄËÕ ËÌÁ×ÉÁÔÕÒÙ" - -msgid "" -"Select a mapping for translating characters as they appear on your video " -"console screen." -msgstr "÷ÙÂÏÒ ËÁÒÔÙ ÄÌÑ ÔÒÁÎÓÌÑÃÉÉ ÓÉÍ×ÏÌÏ× ÎÁ ËÏÎÓÏÌØ." - -msgid "Select a partition." -msgstr "÷ÙÂÏÒ ÒÁÚÄÅÌÁ" - -#, c-format -msgid "" -"Select the disk on which the installation of %s that you wish to configure " -"resides." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÄÉÓË, ÇÄÅ ÎÁÈÏÄÉÔÓÑ ÕÓÔÁÎÏ×ËÁ %s, ËÏÔÏÒÕÀ ×Ù ÈÏÔÉÔÅ ÎÁÓÔÒÏÉÔØ." - -msgid "" -"Select the disk on which the installation that you wish to upgrade resides." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÄÉÓË, ÇÄÅ ÎÁÈÏÄÉÔÓÑ ÕÓÔÁÎÏ×ËÁ %s, ËÏÔÏÒÕÀ ×Ù ÈÏÔÉÔÅ ÏÂÎÏ×ÉÔØ." - -msgid "Select the packages you wish to install from the LiveCD onto the HDD." -msgstr "÷ÙÂÅÒÉÔÅ ÐÁËÅÔÙ, ËÏÔÏÒÙÅ ×Ù ÈÏÔÉÔÅ ÕÓÔÁÎÏ×ÉÔØ Ó LiveCD ÎÁ HDD." - -msgid "Select the packages you wish to install." -msgstr "÷ÙÂÅÒÉÔÅ ÐÁËÅÔÙ, ËÏÔÏÒÙÅ ×Ù ÈÏÔÉÔÅ ÕÓÔÁÎÏ×ÉÔØ." - -msgid "Select the packages you wish to remove from this system" -msgstr "÷ÙÂÅÒÉÔÅ ÐÁËÅÔÙ, ËÏÔÏÒÙÅ ×Ù ÈÏÔÉÔÅ ÕÄÁÌÉÔØ ÉÚ ÓÉÓÔÅÍÙ." - -msgid "" -"Select the partitions (also known as `slices' in BSD tradition) you want to " -"have on this disk.\n" -"\n" -"For Capacity, use 'M' to indicate megabytes, 'G' to indicate gigabytes, or a " -"single '*' to indicate 'use the remaining space on the disk'." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÒÁÚÄÅÌÙ (× BSD ÔÁËÖÅ ÎÁÚÙ×ÁÅÍÙÅ 'ÓÌÁÊÓÁÍÉ'), ËÏÔÏÒÙÅ ×Ù ÈÏÔÉÔÅ " -"ÉÍÅÔØ ÎÁ ÜÔÏÍ ÄÉÓËÅ.\n" -"\n" -"ïÂßÅÍ ÏÂÏÚÎÁÞÁÅÔÓÑ ÃÉÆÒÏÊ Ó 'M' ÄÌÑ ÍÅÇÁÂÁÊÔ, 'G' ÄÌÑ ÇÉÇÁÂÁÊÔ, Á ÚÎÁË " -"'*' ÏÚÎÁÞÁÅÔ 'ÉÓÐÏÌØÚÏ×ÁÔØ ÏÓÔÁ×ÛÅÅÓÑ ÐÒÏÓÔÒÁÎÓÔ×Ï ÎÁ ÄÉÓËÅ'." - -#, c-format -msgid "" -"Select the primary partition of %s (also known as a `slice' in the BSD " -"tradition) on which to install %s." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÏÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ %s (× BSD ÔÁËÖÅ ÎÁÚÙ×ÁÅÍÙÊ 'ÓÌÁÊÓÏÍ') " -"ÄÌÑ ÕÓÔÁÎÏ×ËÉ %s." - -#, c-format -msgid "" -"Select the primary partition of %s on which the installation of %s resides." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÏÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ %s, ÇÄÅ ÕÓÔÁÎÏ×ÌÅÎÁ %s." - -#, c-format -msgid "" -"Select the primary partition of %s on which the installation that you wish " -"to upgrade resides." -msgstr "" -"÷ÙÂÅÒÉÔÅ ÏÓÎÏ×ÎÏÊ ÒÁÚÄÅÌ %s, ÎÁ ËÏÔÏÒÏÍ ÎÁÈÏÄÉÔÓÑ ÕÓÔÁÎÏ×ËÁ, ËÏÔÏÒÕÀ ×Ù " -"ÈÏÔÉÔÅ ÏÂÎÏ×ÉÔØ." - -msgid "Select this to use 'packet mode' to boot the disk" -msgstr "" -"÷ÙÂÅÒÉÔÅ ÜÔÏÔ ÐÕÎËÔ ÄÌÑ ÉÓÐÏÌØÚÏ×ÁÎÉÑ 'ÐÁËÅÔÎÏÇÏ ÒÅÖÉÍÁ' ÚÁÇÒÕÚËÉ ÄÉÓËÁ" - -msgid "Set Root Password" -msgstr "õÓÔÁÎÏ×ÉÔÅ ÐÁÒÏÌØ root" - -msgid "Set Time and Date" -msgstr "õÓÔÁÎÏ×ËÁ ×ÒÅÍÅÎÉ É ÄÁÔÙ" - -msgid "Set Timezone" -msgstr "õÓÔÁÎÏ×ËÁ ×ÒÅÍÅÎÎÏÊ ÚÏÎÙ" - -msgid "Set up NetBoot Server" -msgstr "îÁÓÔÒÏÊËÁ ÓÅÒ×ÅÒÁ NetBoot" - -msgid "" -"Set up the subpartitions (also known as just `partitions' in BSD tradition) " -"you want to have on this primary partition.\n" -"\n" -"For Capacity, use 'M' to indicate megabytes, 'G' to indicate gigabytes, or a " -"single '*' to indicate 'use the remaining space on the primary partition'." -msgstr "" -"õÓÔÁÎÏ×ËÁ ÐÏÄÒÁÚÄÅÌÏ× (ÎÁÚÙ×ÁÅÍÙÈ ÐÒÏÓÔÏ `ÒÁÚÄÅÌÁÍÉ' ÐÏ ÔÒÁÄÉÃÉÉ BSD), " -"ËÏÔÏÒÙÅ ÂÕÄÕÔ ÎÁÈÏÄÉÔØÓÑ ÎÁ ÜÔÏÍ ÏÓÎÏ×ÎÏÍ ÒÁÚÄÅÌÅ.\n" -"\n" -"äÌÑ ÒÁÚÍÅÒÁ ÉÓÐÏÌØÚÕÊÔÅ 'M', ÞÔÏÂÙ ÏÂÏÚÎÁÞÉÔØ ÍÅÇÁÂÁÊÔÙ, 'G', ÞÔÏÂÙ " -"ÏÂÏÚÎÁÞÉÔØ ÇÉÇÁÂÁÊÔÙ, ÉÌÉ ÓÉÍ×ÏÌ '*', ÞÔÏÂÙ ÉÓÐÏÌØÚÏ×ÁÔØ ÏÓÔÁÔÏË ÍÅÓÔÁ ÎÁ " -"ÏÓÎÏ×ÎÏÍ ÒÁÚÄÅÌÅ." - -#, c-format -msgid "Setting password for user `%s'." -msgstr "õÓÔÁÎÏ×ËÁ ÐÁÒÏÌÑ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ `%s'." - -msgid "Shell" -msgstr "ïÂÏÌÏÞËÁ" - -msgid "Skip this Step" -msgstr "ðÒÏÐÕÓË ÜÔÏÇÏ ÄÅÊÓÔ×ÉÑ" - -msgid "Softupdates?" -msgstr "Softupdates?" - -#, c-format -msgid "" -"Some situations in which you might not wish to use this installer are:\n" -"\n" -"- you want to install %s onto a logical/extended partition;\n" -"- you want to install %s onto a ``dangerously dedicated'' disk; or\n" -"- you want full and utter control over the install process." -msgstr "" -"÷ ÎÅËÏÔÏÒÙÈ ÓÉÔÕÁÃÉÑÈ ×Ù ÎÅ ÍÏÖÅÔÅ ÉÓÐÏÌØÚÏ×ÁÔØ ÜÔÕ ÐÒÏÇÒÁÍÍÕ:\n" -"\n" -"- ÕÓÔÁÎÏ×ËÁ %s × ÌÏÇÉÞÅÓËÉÊ/ÒÁÓÛÉÒÅÎÎÙÊ ÒÁÚÄÅÌ;\n" -"- ÕÓÔÁÎÏ×ËÁ %s ÎÁ ``dangerously dedicated'' ÄÉÓË; ÉÌÉ\n" -"- ÎÅÏÂÈÏÄÉÍ ÔÏÔÁÌØÎÙÊ ËÏÎÔÒÏÌØ ÎÁÄ ÐÒÏÃÅÓÓÏÍ ÕÓÔÁÎÏ×ËÉ." - -#, c-format -msgid "" -"Some subpartitions on the selected primary partition are already activated " -"as swap. Since there is no way to deactivate swap in %s once it is " -"activated, in order to edit the subpartition layout of this primary " -"partition, you must first reboot." -msgstr "" -"îÅËÏÔÏÒÙÅ ÐÏÄÒÁÚÄÅÌÙ ÎÁ ×ÙÂÒÁÎÎÏÍ ÏÓÎÏ×ÎÏÍ ÒÁÚÄÅÌÅ ÕÖÅ ÂÙÌÉ ÁËÔÉ×ÉÒÏ×ÁÎÙ ÄÌÑ " -"ÐÏÄËÁÞËÉ. ðÏÓËÏÌØËÕ × %s ÎÅÔ ÓÐÏÓÏÂÁ ÄÅÁËÔÉ×ÉÒÏ×ÁÔØ ÐÏÄËÁÞËÕ, ÄÌÑ " -"ÒÅÄÁËÔÉÒÏ×ÁÎÉÑ ÒÁÓËÌÁÄËÉ ÐÏÄÒÁÚÄÅÌÏ× ÜÔÏÇÏ ÏÓÎÏ×ÎÏÇÏ ÒÁÚÄÅÌÁ ÎÅÏÂÈÏÄÉÍÏ " -"ÓÎÁÞÁÌÁ ÐÅÒÅÇÒÕÚÉÔØÓÑ." - -#, c-format -msgid "" -"Subpartitions further divide a primary partition for use with %s. Some " -"reasons you may want a set of subpartitions are:\n" -"\n" -"- you want to restrict how much data can be written to certain parts of the " -"primary partition, to quell denial-of-service attacks; and\n" -"- you want to speed up access to data on the disk." -msgstr "" -"ðÏÄÒÁÚÄÅÌÙ ÜÔÏ ÄÁÌØÎÅÊÛÅÅ ÒÁÚÄÅÌÅÎÉÅ ÏÓÎÏ×ÎÏÇÏ ÒÁÚÄÅÌÁ ÄÌÑ ÉÓÐÏÌØÚÏ×ÁÎÉÑ Ó %" -"s. ðÒÉÞÉÎÙ, ÐÏ ËÏÔÏÒÙÍ ÍÏÇÕÔ ÐÏÔÒÅÂÏ×ÁÔØÓÑ ÐÏÄÒÁÚÄÅÌÙ:\n" -"\n" -"- ×Ù ÈÏÔÉÔÅ ÏÇÒÁÎÉÞÉÔØ ÏÂßÅÍ ÄÁÎÎÙÈ, ËÏÔÏÒÙÅ ÍÏÇÕÔ ÂÙÔØ ÚÁÐÉÓÁÎÙ ÎÁ " -"ÏÐÒÅÄÅÌÅÎÎÙÅ ÞÁÓÔÉ ÏÓÎÏ×ÎÏÇÏ ÒÁÚÄÅÌÁ ÄÌÑ ÏÓÔÁÎÏ×ËÉ DoS ÁÔÁËÉ; É\n" -"- ×Ù ÈÏÔÉÔÅ ÐÏ×ÙÓÉÔØ ÓËÏÒÏÓÔØ ÄÏÓÔÕÐÁ Ë ÄÁÎÎÙÍ." - -msgid "Switch to Expert Mode" -msgstr "ðÅÒÅËÌÀÞÉÔØÓÑ × ÜËÓÐÅÒÔÎÙÊ ÒÅÖÉÍ" - -msgid "Switch to Normal Mode" -msgstr "ðÅÒÅËÌÀÞÉÔØÓÑ × ÎÏÒÍÁÌØÎÙÊ ÒÅÖÉÍ" - -msgid "Target system was not successfully upgraded." -msgstr "ãÅÌÅ×ÁÑ ÓÉÓÔÅÍÁ ÎÅ ÂÙÌÁ ÕÓÐÅÛÎÏ ÏÂÎÏ×ÌÅÎÁ." - -msgid "Target system was successfully upgraded!" -msgstr "ãÅÌÅ×ÁÑ ÓÉÓÔÅÍÁ ÂÙÌÁ ÕÓÐÅÛÎÏ ÏÂÎÏ×ÌÅÎÁ!" - -#, c-format -msgid "The Time Zone has been successfully set to %s." -msgstr "÷ÒÅÍÅÎÎÁÑ ÚÏÎÁ ÂÙÌÁ ÕÓÐÅÛÎÏ ÕÓÔÁÎÏ×ÌÅÎÁ × %s." - -msgid "The disk on which you wish to install a bootblock" -msgstr "äÉÓË, ÎÁ ËÏÔÏÒÙÊ ÂÕÄÅÔ ÕÓÔÁÎÏ×ÌÅÎ ÚÁÇÒÕÚÏÞÎÙÊ ÂÌÏË" - -#, c-format -msgid "" -"The following installed packages require one or more of the packages you " -"selected, and will also be removed:\n" -"\n" -"%s\n" -"Is this acceptable?" -msgstr "" -"óÌÅÄÕÀÝÉÍ ÐÁËÅÔÁÍ ÔÒÅÂÕÅÔÓÑ ÏÄÉÎ ÉÌÉ ÂÏÌÅÅ ×ÙÂÒÁÎÎÙÈ ÐÁËÅÔÏ×, É ÏÎÉ ÔÁËÖÅ " -"ÂÕÄÕÔ ÕÄÁÌÅÎÙ:\n" -"\n" -"%s\n" -"õÄÁÌÉÔØ ÉÈ?" - -#, c-format -msgid "" -"óÌÅÄÕÀÝÉÅ ÐÁËÅÔÙ ÔÒÅÂÕÀÔÓÑ ×ÙÂÒÁÎÎÙÍ ÐÁËÅÔÁÍ, É ÏÎÉ ÔÁËÖÅ ÂÕÄÕÔ " -"ÕÓÔÁÎÏ×ÌÅÎÙ:\n" -"\n" -"%s\n" -"õÓÔÁÎÏ×ÉÔØ ÉÈ?" -msgstr "" - -#, c-format -msgid "" -"The installer could not find any disks suitable for installation (IDE or " -"SCSI) attached to this computer. If you wish to install %s on an unorthodox " -"storage device, you will have to exit to a LiveCD command prompt and install " -"it manually, using the file /README as a guide." -msgstr "" -"ðÒÏÇÒÁÍÍÁ ÕÓÔÁÎÏ×ËÉ ÎÅ ÍÏÖÅÔ ÎÁÊÔÉ ÎÁ ÜÔÏÍ ËÏÍÐØÀÔÅÒÅ ÄÉÓËÉ, ÐÏÄÈÏÄÑÝÉÅ ÄÌÑ " -"ÕÓÔÁÎÏ×ËÉ (IDE ÉÌÉ SCSI). åÓÌÉ ×Ù ÈÏÔÉÔÅ ÕÓÔÁÎÏ×ÉÔØ %s ÎÁ ÄÒÕÇÏÅ " -"ÕÓÔÒÏÊÓÔ×Ï, ÎÅÏÂÈÏÄÉÍÏ ×ÙÊÔÉ × ÐÒÉÇÌÁÛÅÎÉÅ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ LiveCD É " -"ÐÒÏ×ÅÓÔÉ ÕÓÔÁÎÏ×ËÕ ×ÒÕÞÎÕÀ, ÉÓÐÏÌØÚÕÑ ÆÁÊÌ /README × ËÁÞÅÓÔ×Å ÒÕËÏ×ÏÄÓÔ×Á." - -#, c-format -msgid "" -"The installer could not find any suitable disks attached to this computer. " -"If you wish to configure an installation of %s on an unorthodox storage " -"device, you will have to exit to a LiveCD command prompt and configure it " -"manually, using the file /README as a guide." -msgstr "" -"ðÒÏÇÒÁÍÍÁ ÕÓÔÁÎÏ×ËÉ ÎÅ ÓÍÏÇÌÁ ÎÁÊÔÉ ÎÉ ÏÄÎÏÇÏ ÐÏÄÈÏÄÑÝÅÇÏ ÄÉÓËÁ ÎÁ ÜÔÏÍ " -"ËÏÍÐØÀÔÅÒÅ. åÓÌÉ ×Ù ÈÏÔÉÔÅ ÎÁÓÔÒÏÉÔØ ÕÓÔÁÎÏ×ËÕ %s ÎÁ ÄÒÕÇÏÍ ÕÓÔÒÏÊÓÔ×Å " -"ÈÒÁÎÅÎÉÑ, ×ÁÍ ÐÏÔÒÅÂÕÅÔÓÑ ×ÙÊÔÉ × ÐÒÉÇÌÁÛÅÎÉÅ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ LiveCD " -"É ÎÁÓÔÒÏÉÔØ ÜÔÏ ÕÓÔÒÏÊÓÔ×Ï ×ÒÕÞÎÕÀ, ÉÓÐÏÌØÚÕÑ ÆÁÊÌ /README × ËÁÞÅÓÔ×Å " -"ÒÕËÏ×ÏÄÓÔ×Á." - -msgid "" -"The installer could not find any suitable disks attached to this computer. " -"If you wish to upgrade an installation located on an unorthodox storage " -"device, you will have to exit to a LiveCD command prompt and configure it " -"manually, using the file /README as a guide." -msgstr "" -"ðÒÏÇÒÁÍÍÁ ÕÓÔÁÎÏ×ËÉ ÎÅ ÓÍÏÇÌÁ ÎÁÊÔÉ ÎÉ ÏÄÎÏÇÏ ÐÏÄÈÏÄÑÝÅÇÏ ÄÉÓËÁ ÎÁ ÜÔÏÍ " -"ËÏÍÐØÀÔÅÒÅ. åÓÌÉ ×Ù ÈÏÔÉÔÅ ÏÂÎÏ×ÉÔØ ÕÓÔÁÎÏ×ËÕ ÎÁ ÄÒÕÇÏÍ ÕÓÔÒÏÊÓÔ×Å " -"ÈÒÁÎÅÎÉÑ, ×ÁÍ ÐÏÔÒÅÂÕÅÔÓÑ ×ÙÊÔÉ × ÐÒÉÇÌÁÛÅÎÉÅ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ LiveCD " -"É ÎÁÓÔÒÏÉÔØ ÜÔÏ ÕÓÔÒÏÊÓÔ×Ï ×ÒÕÞÎÕÀ, ÉÓÐÏÌØÚÕÑ ÆÁÊÌ /README × ËÁÞÅÓÔ×Å " -"ÒÕËÏ×ÏÄÓÔ×Á." - -msgid "The name of the login group contains illegal characters." -msgstr "éÍÑ ÇÒÕÐÐÙ ÓÏÄÅÒÖÉÔ ÎÅÄÏÐÕÓÔÉÍÙÅ ÓÉÍ×ÏÌÙ." - -msgid "The passwords do not match." -msgstr "ðÁÒÏÌÉ ÎÅ ÓÏ×ÐÁÄÁÀÔ." - -msgid "The root password has been changed." -msgstr "ðÁÒÏÌØ root ÂÙÌ ÉÚÍÅÎÅÎ." - -msgid "The selected shell does not exist on the system." -msgstr "÷ÙÂÒÁÎÎÁÑ ÏÂÏÌÏÞËÁ ÎÅ ÕÓÔÁÎÏ×ÌÅÎÁ × ÓÉÓÔÅÍÅ." - -msgid "The target system could not be successfully mounted." -msgstr "ãÅÌÅ×ÁÑ ÆÁÊÌÏ×ÁÑ ÓÉÓÔÅÍÁ ÎÅ ÍÏÖÅÔ ÂÙÔØ ÓÍÏÎÔÉÒÏ×ÁÎÁ." - -msgid "The target system could not be successfully probed." -msgstr "ãÅÌÅ×ÁÑ ÆÁÊÌÏ×ÁÑ ÓÉÓÔÅÍÁ ÎÅ ÍÏÖÅÔ ÂÙÔØ ÐÒÏÔÅÓÔÉÒÏ×ÁÎÁ." - -msgid "The text specified in the Real Name field contains illegal characters." -msgstr "ôÅËÓÔ × ÐÏÌÅ 'ðÏÌÎÏÅ ÉÍÑ' ÓÏÄÅÒÖÉÔ ÎÅÄÏÐÕÓÔÉÍÙÅ ÓÉÍ×ÏÌÙ." - -msgid "The time and date have successfully been set." -msgstr "÷ÒÅÍÑ É ÄÁÔÁ ÂÙÌÉ ÕÓÐÅÛÎÏ ÕÓÔÁÎÏ×ÌÅÎÙ." - -msgid "The username contains illegal characters." -msgstr "éÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ ÓÏÄÅÒÖÉÔ ÎÅÄÏÐÕÓÔÉÍÙÅ ÓÉÍ×ÏÌÙ." - -msgid "There are no packages installed on this system." -msgstr "÷ ÓÉÓÔÅÍÅ ÎÅÔ ÕÓÔÁÎÏ×ÌÅÎÎÙÈ ÐÁËÅÔÏ×." - -msgid "" -"There were errors. Some packages may not have been successfully removed." -msgstr "ðÒÏÉÚÏÛÌÉ ÏÛÉÂËÉ. îÅËÏÔÏÒÙÅ ÐÁËÅÔÙ ÍÏÇÌÉ ÂÙÔØ ÎÅ ÕÄÁÌÅÎÙ." - -#, c-format -msgid "" -"This experimental application will install %s on one of the hard disk drives " -"attached to this computer. It has been designed to make it easy to install %" -"s in the typical case. If you have special requirements that are not " -"addressed by this installer, or if you have problems using it, you are " -"welcome to install %s manually. To do so select Exit to Live CD, login as " -"root, and follow the instructions given in the file /README .\n" -"\n" -"NOTE! As with any installation process, YOU ARE STRONGLY ENCOURAGED TO BACK " -"UP ANY IMPORTANT DATA ON THIS COMPUTER BEFORE PROCEEDING!" -msgstr "" -"üÔÁ ÜËÓÐÅÒÉÍÅÎÔÁÌØÎÁÑ ÐÒÏÇÒÁÍÍÁ ÕÓÔÁÎÏ×ÉÔ %s ÎÁ ÏÄÉÎ ÉÚ ÐÏÄËÌÀÞÅÎÎÙÈ Ë " -"ËÏÍÐØÀÔÅÒÕ ÖÅÓÔËÉÈ ÄÉÓËÏ×. ïÎÁ ÂÙÌÁ ÒÁÚÒÁÂÏÔÁÎÁ ÄÌÑ ÕÐÒÏÝÅÎÉÑ ÔÉÐÉÞÎÏÊ " -"ÕÓÔÁÎÏ×ËÉ %s. åÓÌÉ ×Ù ÐÒÅÄßÑ×ÌÑÅÔÅ Ë ÕÓÔÁÎÏ×ËÅ ÏÓÏÂÙÅ ÔÒÅÂÏ×ÁÎÉÑ, ÎÅ " -"ÕÄÏ×ÌÅÔ×ÏÒÑÅÍÙÅ ÜÔÏÊ ÐÒÏÇÒÁÍÍÏÊ, ÉÌÉ Õ ×ÁÓ ÐÒÏÂÌÅÍÙ Ó ÅÅ ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ, " -"ÕÓÔÁÎÏ×ÉÔÅ %s ×ÒÕÞÎÕÀ. äÌÑ ÜÔÏÇÏ ×ÙÊÄÉÔÅ ÉÚ Live CD, ×ÏÊÄÉÔÅ ÐÏÄ root, É " -"ÓÌÅÄÕÊÔÅ ÉÎÓÔÒÕËÃÉÑÍ × ÆÁÊÌÅ /README .\n" -"\n" -"÷îéíáîéå! ëÁË É Ó ÌÀÂÙÍ ÐÒÏÃÅÓÓÏÍ ÕÓÔÁÎÏ×ËÉ, îáóôïñôåìøîï òåëïíåîäõåôóñ " -"óäåìáôø òåúåò÷îõà ëïðéà ÷óåè ÷áöîùè äáîîùè ðåòåä îáþáìïí õóôáîï÷ëé!" - -msgid "" -"This machine is about to be shut down. After the machine has reached its " -"shutdown state, you may remove the CD from the CD-ROM drive tray and press " -"Enter to reboot from the HDD." -msgstr "" -"ëÏÍÐØÀÔÅÒ ÂÕÄÅÔ ÐÅÒÅÚÁÇÒÕÖÅÎ. ðÏÓÌÅ ÚÁ×ÅÒÛÅÎÉÑ ÒÁÂÏÔÙ ÓÉÓÔÅÍÙ ×Ù ÍÏÖÅÔÅ " -"ÉÚ×ÌÅÞØ ËÏÍÐÁËÔ-ÄÉÓË ÉÚ ÐÒÉ×ÏÄÁ É ÎÁÖÁÔØ Enter ÄÌÑ ÚÁÇÒÕÚËÉ Ó ÖÅÓÔËÏÇÏ ÄÉÓËÁ." - -msgid "UTC Time" -msgstr "÷ÒÅÍÑ UTC" - -msgid "Upgrade a system with to the newest available version" -msgstr "ïÂÎÏ×ÌÅÎÉÅ ÓÉÓÔÅÍÙ ÄÏ ÐÏÓÌÅÄÎÅÊ ÄÏÓÔÕÐÎÏÊ ×ÅÒÓÉÉ" - -msgid "Upgrade an Installed System" -msgstr "ïÂÎÏ×ÌÅÎÉÅ ÕÓÔÁÎÏ×ÌÅÎÎÏÊ ÓÉÓÔÅÍÙ" - -msgid "User ID" -msgstr "ID ÐÏÌØÚÏ×ÁÔÅÌÑ" - -#, c-format -msgid "User `%s' was added." -msgstr "ðÏÌØÚÏ×ÁÔÅÌØ `%s' ÂÙÌ ÄÏÂÁ×ÌÅÎ" - -msgid "User was not successfully added." -msgstr "ðÏÌØÚÏ×ÁÔÅÌØ ÎÅ ÂÙÌ ÄÏÂÁ×ÌÅÎ" - -msgid "Username" -msgstr "éÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ" - -#, c-format -msgid "" -"WARNING! ALL data in primary partition #%d,\n" -"\n" -"%s\n" -"\n" -"on the disk\n" -"\n" -"%s\n" -"\n" -" will be IRREVOCABLY ERASED!\n" -"\n" -"Are you ABSOLUTELY SURE you wish to take this action? This is your LAST " -"CHANCE to cancel!" -msgstr "" -"÷îéíáîéå! ÷óå ÄÁÎÎÙÅ ÏÓÎÏ×ÎÏÇÏ ÒÁÚÄÅÌÁ #%d,\n" -"\n" -"%s\n" -"\n" -"ÎÁ ÄÉÓËÅ\n" -"\n" -"%s\n" -"\n" -" ÂÕÄÕÔ îå÷ïóóôáîï÷éíï õäáìåîù!\n" -"\n" -"÷Ù áâóïìàôîï õ÷åòåîù, ÞÔÏ ÈÏÔÉÔÅ ×ÙÐÏÌÎÉÔØ ÜÔÏ ÄÅÊÓÔ×ÉÅ? üÔÏ ðïóìåäîéê ûáîó " -"ÏÔÍÅÎÉÔØ ÄÅÊÓÔ×ÉÅ!" - -#, c-format -msgid "" -"WARNING: The total number of sectors needed for the requested partitions (%" -"d) exceeds the number of sectors available on the disk (%d) by %d sectors (%" -"s.)\n" -"\n" -"This is an invalid configuration; we recommend shrinking the size of one or " -"more partitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" -"÷îéíáîéå: ïÂÝÅÅ ËÏÌÉÞÅÓÔ×Ï ÓÅËÔÏÒÏ×, ÎÅÏÂÈÏÄÉÍÙÈ ÄÌÑ ×ÙÂÒÁÎÎÙÈ ÒÁÚÄÅÌÏ× (%" -"d) ÐÒÅ×ÙÛÁÅÔ ËÏÌÉÞÅÓÔ×Ï ÓÅËÔÏÒÏ×, ÄÏÓÔÕÐÎÙÈ ÎÁ ÄÉÓËÅ (%d) ÎÁ %d ÓÅËÔÏÒÏ× (%" -"s.)\n" -"\n" -"üÔÏ ÎÅ×ÅÒÎÁÑ ËÏÎÆÉÇÕÒÁÃÉÑ; ÍÙ ÒÅËÏÍÅÎÄÕÅÍ ÕÒÅÚÁÔØ ÒÁÚÍÅÒ ÏÄÎÏÇÏ ÉÌÉ ÂÏÌÅÅ " -"ÒÁÚÄÅÌÏ× ÐÅÒÅÄ ÔÅÍ, ËÁË ÐÒÏÄÏÌÖÉÔØ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -#, c-format -msgid "" -"WARNING: The total number of sectors needed for the requested subpartitions " -"(%d) exceeds the number of sectors available in the partition (%d) by %d " -"sectors (%s.)\n" -"\n" -"This is an invalid configuration; we recommend shrinking the size of one or " -"more subpartitions before proceeding.\n" -"\n" -"Proceed anyway?" -msgstr "" -"WARNING: The total number of sectors needed for the requested subpartitions " -"(%d) exceeds the number of sectors available in the partition (%d) by %d " -"sectors (%s.)\n" -"\n" -"This is an invalid configuration; we recommend shrinking the size of one or " -"more subpartitions before proceeding.\n" -"\n" -"Proceed anyway?" -"÷îéíáîéå: ïÂÝÅÅ ËÏÌÉÞÅÓÔ×Ï ÓÅËÔÏÒÏ×, ÎÅÏÂÈÏÄÉÍÙÈ ÄÌÑ ×ÙÂÒÁÎÎÙÈ ÐÏÄÒÁÚÄÅÌÏ× " -"(%d) ÐÒÅ×ÙÛÁÅÔ ËÏÌÉÞÅÓÔ×Ï ÓÅËÔÏÒÏ×, ÄÏÓÔÕÐÎÙÈ × ÒÁÚÄÅÌÅ (%d) ÎÁ %d ÓÅËÔÏÒÏ× " -"(%s.)\n" -"\n" -"üÔÏ ÎÅ×ÅÒÎÁÑ ËÏÎÆÉÇÕÒÁÃÉÑ; ÍÙ ÒÅËÏÍÅÎÄÕÅÍ ÕÒÅÚÁÔØ ÒÁÚÍÅÒ ÏÄÎÏÇÏ ÉÌÉ ÂÏÌÅÅ " -"ÐÏÄÒÁÚÄÅÌÏ× ÐÅÒÅÄ ÔÅÍ, ËÁË ÐÒÏÄÏÌÖÉÔØ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -#, c-format -msgid "" -"WARNING: the %s subpartition should be at least %s in size or you will risk " -"running out of space during the installation.\n" -"\n" -"Proceed anyway?" -msgstr "" -"÷îéíáîéå: ÐÏÄÒÁÚÄÅÌ %s ÄÏÌÖÅÎ ÉÍÅÔØ ÒÁÚÍÅÒ ËÁË ÍÉÎÉÍÕÍ %s, ÉÌÉ ÂÕÄÅÔ ÒÉÓË " -"ÎÅÈ×ÁÔËÉ ÍÅÓÔÁ ÐÒÉ ÕÓÔÁÎÏ×ËÅ.\n" -"\n" -"ðÒÏÄÏÌÖÉÔØ ÎÅÓÍÏÔÒÑ ÎÁ ÜÔÏ?" - -#, c-format -msgid "" -"WARNING: you should have a disk at least %dM in size, or you may encounter " -"problems trying to install %s." -msgstr "" -"ðòåäõðòåöäåîéå: ÄÉÓË ÄÏÌÖÅÎ ÉÍÅÔØ ÒÁÚÍÅÒ ËÁË ÍÉÎÉÍÕÍ %dM, ÉÌÉ Õ ×ÁÓ ÍÏÇÕÔ " -"×ÏÚÎÉËÎÕÔØ ÐÒÏÂÌÅÍÙ ÐÒÉ ÕÓÔÁÎÏ×ËÅ %s." - -#, c-format -msgid "" -"WARNING: you should have a primary partition at least %dM in size, or you " -"may encounter problems trying to install %s." -msgstr "" -"ðòåäõðòåöäåîéå: ÒÁÚÍÅÒ ÏÓÎÏ×ÎÏÇÏ ÒÁÚÄÅÌÁ ÄÏÌÖÅÎ ÂÙÔØ ÎÅ ÍÅÎÅÅ %dM, ÉÌÉ ÐÒÉ " -"ÕÓÔÁÎÏ×ËÅ %s ÍÏÇÕÔ ×ÏÚÎÉËÎÕÔØ ÐÒÏÂÌÅÍÙ." - -#, c-format -msgid "Waiting for interface %s to come up." -msgstr "ïÖÉÄÁÎÉÅ ÐÏÄßÅÍÁ ÉÎÔÅÒÆÅÊÓÁ %s." - -msgid "" -"Warning: already-mounted target system could not be correctly unmounted " -"first." -msgstr "" -"÷ÎÉÍÁÎÉÅ: ÓÍÏÎÔÉÒÏ×ÁÎÎÁÑ ÆÁÊÌÏ×ÁÑ ÓÉÓÔÅÍÁ ÎÅ ÍÏÖÅÔ ÂÙÔØ ËÏÒÒÅËÔÎÏ ÒÁÚÍÏÎÔÉÒÏ×ÁÎÁ." - -msgid "Warning: subpartitions were not correctly unmounted." -msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÐÏÄÒÁÚÄÅÌÙ ÎÅ ÂÙÌÉ ÐÒÁ×ÉÌØÎÏ ÏÔÍÏÎÔÉÒÏ×ÁÎÙ." - -msgid "" -"Would you like to try dynamically configuring this interface? (This requires " -"that you have a DHCP server operating on the network that this interface is " -"attached to.)" -msgstr "" -"èÏÔÉÔÅ ÌÉ ×Ù ×ËÌÀÞÉÔØ ÄÉÎÁÍÉÞÅÓËÏÅ ËÏÎÆÉÇÕÒÉÒÏ×ÁÎÉÅ ÉÎÔÅÒÆÅÊÓÁ? (üÔÏ ÔÒÅÂÕÅÔ " -"ÎÁÌÉÞÉÑ DHCP ÓÅÒ×ÅÒÁ × ÓÅÔÉ, Ë ËÏÔÏÒÏÊ ÐÏÄËÌÀÞÅÎ ÜÔÏÔ ÓÅÔÅ×ÏÊ ÉÎÔÅÒÆÅÊÓ)." - -msgid "Year" -msgstr "çÏÄ" - -#, c-format -msgid "" -"You have elected to not have the following subpartition(s):\n" -"\n" -"%s\n" -"\n" -"The ramifications of these subpartition(s) being missing will be:\n" -"\n" -"%s\n" -"Is this really what you want to do?" -msgstr "" -"÷Ù ÏÔËÁÚÁÌÉÓØ ÏÔ ÓÏÚÄÁÎÉÑ ÓÌÅÄÕÀÝÉÈ ÐÏÄÒÁÚÄÅÌÏ×:\n" -"\n" -"%s\n" -"\n" -"üÔÉ ÐÏÄÒÁÚÄÅÌÙ ÂÕÄÕÔ ÚÁÍÅÎÅÎÙ ÔÁË:\n" -"\n" -"%s\n" -"÷Ù ÄÅÊÓÔ×ÉÔÅÌØÎÏ ÐÏÄÔ×ÅÒÖÄÁÅÔÅ ÜÔÏ?" - -msgid "" -"You have not yet configured your network settings. Would you like to do so " -"now? (Having an operational network connection will enhance the ability of " -"subsequent tasks, such as installing." -msgstr "" -"÷Ù ÅÝÅ ÎÅ ÎÁÓÔÒÏÉÌÉ ÓÅÔØ. èÏÔÉÔÅ ÌÉ ×Ù ÓÄÅÌÁÔØ ÜÔÏ ÓÅÊÞÁÓ? (îÁÌÉÞÉÅ ÒÁÂÏÔÁÀÝÅÇÏ " -"ÓÅÔÅ×ÏÇÏ ÐÏÄËÌÀÞÅÎÉÑ ÄÏÂÁ×ÉÔ ×ÏÚÍÏÖÎÏÓÔÅÊ ÐÏÓÌÅÄÕÀÝÉÍ ÚÁÄÁÞÁÍ, ÔÁËÉÍ ËÁË " -"ÕÓÔÁÎÏ×ËÁ." - -msgid "" -"You may now format and partition this disk if you desire.\n" -"\n" -"If this is a brand new disk, you should do this. If you would like to place " -"multiple operating systems on this disk, you should create multiple " -"partitions, one for each operating system.\n" -"\n" -"If this disk already has operating systems on it that you wish to keep, you " -"should NOT do this, and should skip this step.\n" -"\n" -"Format and partition this disk?" -msgstr "" -"ôÅÐÅÒØ ×Ù ÍÏÖÅÔÅ ÏÔÆÏÒÍÁÔÉÒÏ×ÁÔØ É ÒÁÚÂÉÔØ ÎÁ ÒÁÚÄÅÌÙ ÄÉÓË.\n" -"\n" -"åÓÌÉ ÜÔÏ ÎÏ×ÙÊ ÄÉÓË, ÓÄÅÌÁÊÔÅ ÜÔÏ. åÓÌÉ ×Ù ÈÏÔÉÔÅ ÐÏÍÅÓÔÉÔØ ÎÁ ÜÔÏÔ ÄÉÓË " -"ÎÅÓËÏÌØËÏ ÏÐÅÒÁÃÉÏÎÎÙÈ ÓÉÓÔÅÍ, ×ÁÍ ÐÏÔÒÅÂÕÅÔÓÑ ÓÏÚÄÁÔØ ÎÅÓËÏÌØËÏ ÒÁÚÄÅÌÏ×, " -"ÐÏ ÏÄÎÏÍÕ ÎÁ ËÁÖÄÕÀ ÏÐÅÒÁÃÉÏÎÎÕÀ ÓÉÓÔÅÍÕ.\n" -"\n" -"åÓÌÉ ÎÁ ÄÉÓËÅ ÕÖÅ ÎÁÈÏÄÉÔÓÑ ÏÐÅÒÁÃÉÏÎÎÁÑ ÓÉÓÔÅÍÁ, ËÏÔÏÒÕÀ ×Ù ÈÏÔÉÔÅ ÓÏÈÒÁÎÉÔØ, " -"îå ÄÅÌÁÊÔÅ ÜÔÏÇÏ É ÐÒÏÐÕÓÔÉÔÅ ÜÔÏÔ ÛÁÇ.\n" -"\n" -"ïÔÆÏÒÍÁÔÉÒÏ×ÁÔØ ÄÉÓË É ÒÁÚÂÉÔØ ÅÇÏ ÎÁ ÒÁÚÄÅÌÙ?" - -#, c-format -msgid "" -"You may now wish to install bootblocks on one or more disks. If you already " -"have a boot manager installed, you can skip this step (but you may have to " -"configure your boot manager separately.) If you installed %s on a disk " -"other than your first disk, you will need to put the bootblock on at least " -"your first disk and the %s disk." -msgstr "" -"÷Ù ÍÏÖÅÔÅ ÕÓÔÁÎÏ×ÉÔØ ÚÁÇÒÕÚÏÞÎÙÅ ÂÌÏËÉ ÎÁ ÏÄÉÎ ÉÌÉ ÎÅÓËÏÌØËÏ ÄÉÓËÏ×. åÓÌÉ " -"ÍÅÎÅÄÖÅÒ ÚÁÇÒÕÚËÉ ÕÖÅ ÕÓÔÁÎÏ×ÌÅÎ, ÜÔÏÔ ÛÁÇ ÍÏÖÎÏ ÐÒÏÐÕÓÔÉÔØ (ÎÏ ÍÅÎÅÄÖÅÒ " -"ÚÁÇÒÕÚËÉ ÎÅÏÂÈÏÄÉÍÏ ÎÁÓÔÒÏÉÔØ ÏÔÄÅÌØÎÏ). åÓÌÉ %s ÕÓÔÁÎÁ×ÌÉ×ÁÅÔÓÑ ÎÅ ÎÁ " -"ÐÅÒ×ÙÊ ÄÉÓË, ÚÁÇÒÕÚÏÞÎÙÊ ÂÌÏË ÎÅÏÂÈÏÄÉÍÏ ÐÏÍÅÓÔÉÔØ ÈÏÔÑ ÂÙ ÎÁ ÐÅÒ×ÙÊ ÄÉÓË É " -"ÄÉÓË Ó %s." - -msgid "You must enter a username." -msgstr "îÅÏÂÈÏÄÉÍÏ ××ÅÓÔÉ ÉÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ" diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/apptest.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/apptest.lua deleted file mode 100644 index e3507352f1..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/apptest.lua +++ /dev/null @@ -1,59 +0,0 @@ --- $Id: apptest.lua,v 1.7 2005/02/02 22:26:20 cpressey Exp $ - -require "app" -require "storage" - -App.start({ - name = "Test application", - logfile = "testapp.log", - ui = Dfui.new{ - transport = "tcp", - rendezvous = "9999" - } -}) - -print("OS is: " .. App.os.name) - --- Create a storage-descriptor for the application. -App.state.storage = StorageDescriptor.new() -App.state.storage:survey() - -print(App.expand("The root is ``${root}'' and the temp dir is ``${tmp}''.")) -print(App.expand("And cpdup is ``${CPDUP}''.")) -print(App.expand("And boo is ``${BOO}''.")) - -t1 = App.open_tmpfile("foo.txt", "w") -if t1 then - t1:write("This goes into foo.txt.") - t1:close() -else - App.log_warn("Can't open ${tmp}/foo.txt!") -end - -t2, t2_name = App.open_tmpfile() -if t2 then - t2:write("This goes into some file called " .. t2_name .. ".") - t2:close() -else - App.log_warn("Can't open ${tmp}/" .. t2_name .. "!") -end - -t1 = App.open_tmpfile("foo.txt", "r") -if t1 then - for line in t1:lines() do print("foo.txt:", line) end - t1:close() -end - -t2 = App.open_tmpfile(t2_name, "r") -if t2 then - for line in t2:lines() do print(t2_name .. ":", line) end - t2:close() -end - -App.view_log() - -if App.ui:confirm("Confirm dialog test. Show an inform dialog?") then - App.ui:inform("Inform dialog test.") -end - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/bitwise.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/bitwise.lua deleted file mode 100644 index 71dc859bc2..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/bitwise.lua +++ /dev/null @@ -1,16 +0,0 @@ --- $Id: bitwise.lua,v 1.2 2005/02/22 02:54:32 cpressey Exp $ - -require "bitwise" - -d = function(a, b) - print(a, b, - "a & b = " .. Bitwise.bw_and(a, b), - "a | b = " .. Bitwise.bw_or(a, b) - ) -end - -d(255, 64) -d(256, 63) -d(256, 256) -d(64, 255) -d(10, 12) diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/clock.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/clock.lua deleted file mode 100644 index 7ba68b4c80..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/clock.lua +++ /dev/null @@ -1,11 +0,0 @@ --- $Id: clock.lua,v 1.1 2005/02/01 21:58:24 cpressey Exp $ - -for i = 1, 30 do - print("Waiting " .. (i * 50000000) .. " nanoseconds ...") - Clock.nanosleep(0, i * 50000000) -end - -for i = 1, 30 do - print("Waiting " .. (i * 0.05) .. " seconds ...") - Clock.nanosleep(i * 0.05) -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/commands.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/commands.lua deleted file mode 100644 index 0efe8b599d..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/commands.lua +++ /dev/null @@ -1,45 +0,0 @@ --- test code for Lua<->DFUI binding. --- $Id: commands.lua,v 1.16 2005/02/18 04:30:49 cpressey Exp $ - -require "cmdchain" -require "dfui" - -App.start{ - name = "Command-execution test program", - logfile = "cmdtest.log", - ui = DFUI.new{ - transport = "tcp", - rendezvous = "9999" - } -} - --- App.option.fake_execution = true - -cc = CmdChain.new() - -cc:add( - { cmdline = "touch /tmp/testing" }, - { cmdline = "sleep 5", desc = "We're waiting five seconds..." }, - { cmdline = "ls -la /tmp/", capture = "ls" } -) - -r = cc:preview() -print("cc:preview()=",r) - -r = cc:execute() -print("cc:execute()=",r) - -r = cc:get_output("ls") -print("cc:get_output(ls)=", r) -for i in r do - print("-->", r[i]) -end - -print("*** writing command chain as script to stdout ***") -cc:record(io.stdout) -print("*** command chain script written to stdout ***") - -r = CmdChain.new("echo 'hi'", "echo 'there'"):execute() -print("cc:execute()=",r) - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/configvars.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/configvars.lua deleted file mode 100644 index ac44a489fe..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/configvars.lua +++ /dev/null @@ -1,19 +0,0 @@ --- $Id: configvars.lua,v 1.1 2004/11/28 03:52:05 cpressey Exp $ --- Test of ConfigVars objects. - -require "app" -require "configvars" - -App.start() - -local fh = io.open("/tmp/test.conf", "w") -fh:write("# comment\n") -fh:write("BOO=Baz\n") -fh:write([[FOO=Silly"'"Quote'"'Madness"'!!!'"]] .. "\n") -fh:close() - -local cv = ConfigVars.new() -if not cv:read("/tmp/test.conf") then error("Couldn't read test.conf") end -if not cv:write("/tmp/out.conf") then error("Couldn't write out.conf") end - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/dfui.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/dfui.lua deleted file mode 100644 index 8d2b73a7d1..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/dfui.lua +++ /dev/null @@ -1,45 +0,0 @@ --- $Id: dfui.lua,v 1.1 2005/02/08 21:16:17 cpressey Exp $ - -require "app" -require "dfui" - -App.start({ - name = "Test application", - logfile = "testapp.log", - ui = DFUI.new{ - transport = "tcp", - rendezvous = "9999" - } -}) - -App.ui:present{ - id = "typical_form", - name = "Typical Form", - short_desc = "This is a typical form.", - fields = { - { - id = "name", - name = "Name" - }, - { - id = "type", - name = "Type", - options = { - "First", "Second", "Third" - } - } - }, - datasets = { - { - name = "Charles", - type = "First" - } - } - actions = { - { - id = "ok", name = "OK" - } - } -} - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/expander.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/expander.lua deleted file mode 100644 index 8a0ce40e57..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/expander.lua +++ /dev/null @@ -1,26 +0,0 @@ --- $Id: expander.lua,v 1.1 2004/11/20 19:29:22 cpressey Exp $ --- Test of expander library. - -require "expander" - -dir_table = { - root = "/", - home = "/home/me/", - tmp = "/var/tmp/", - conf = "/var/conf/" -} - -cmd_table = { - gel = "bin/gel", - spritz = "sbin/spritz", - mousse = "usr/bin/mousse", - conf = "usr/local/bin/conf" -} - -e = Expander.new(dir_table, cmd_table) - -print(e:expand("${root}${gel}")) -print(e:expand("${tmp}${conf}")) -print(e:expand("${home}${spritz}")) -print(e:expand("${home}${spritz}", { spritz = "usr/local/sbin/cabbage" } )) -print(e:expand("${home}${boo}")) diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/filesystem.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/filesystem.lua deleted file mode 100644 index 147d7f9a34..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/filesystem.lua +++ /dev/null @@ -1,45 +0,0 @@ --- filesystem.lua --- $Id: filesystem.lua,v 1.10 2005/03/27 07:21:08 cpressey Exp $ --- Test of dfuibe_lua's filesystem functionalities. - -App = require "app"; App.init() -require "mountpoint" - -local booltab = { [false] = "NO", [true] = "YES" } - -App.start{ - name = "FileSystem/MountPoints test program", - logfile = "filesystem.log" -} - -files = FileSystem.dir("/etc") -for file in files do - local fullfile = "/etc/" .. files[file] - local string = fullfile .. "..." .. - " is file? " .. booltab[FileSystem.is_file(fullfile)] .. - " is dir? " .. booltab[FileSystem.is_dir(fullfile)] .. - " is program? " .. booltab[FileSystem.is_program(fullfile)] .. - " size=" .. tostring(FileSystem.size_of(fullfile)) - print(string) -end - -path = "/x/y/z" -print("basename of " .. path .. " is " .. FileSystem.basename(path)) -print("dirname of " .. path .. " is " .. FileSystem.dirname(path)) - -local fh, fname = FileSystem.mkstemp("/tmp/tmp.XXXXXX") -fh:write("hello!\n") -fh:close() -print("Wrote hello! to " .. fname) - -local fs_descs = MountPoints.enumerate() -local i, fs_desc -for i, fs_desc in fs_descs do - print( - "mountpoint=", fs_desc.mountpoint, - "device=", fs_desc.device, - "type=", fs_desc.type - ) -end - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm.lua deleted file mode 100644 index 8b7d3deda6..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm.lua +++ /dev/null @@ -1,34 +0,0 @@ --- fsm.lua --- $Id: fsm.lua,v 1.5 2004/11/26 00:31:03 cpressey Exp $ --- Test of the FSM library. - -require("fsm") - --- manually create a finite state machine, --- manually populate it with states, and --- manually start it: - -fsm = FSM.new() - -fsm:register({ - name = "start", - action = function() - print("This is the start.") - return "middle" - end}) - -fsm:register({ - name = "middle", - action = function() - print("Also, this is the middle...") - return "end" - end}) - -fsm:register({ - name = "end", - action = function() - print("And finally, this is the end!") - return nil - end}) - -fsm:run("start") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/final.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/final.lua deleted file mode 100644 index 8453422c4a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/final.lua +++ /dev/null @@ -1,9 +0,0 @@ --- $Id: final.lua,v 1.4 2004/11/26 00:31:03 cpressey Exp $ - -return { - name = "final", - action = function(fsm) - print("Finally, this is the end!") - return nil - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/main.lua deleted file mode 100644 index e6674213db..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/main.lua +++ /dev/null @@ -1,11 +0,0 @@ --- fsm/main.lua --- $Id: main.lua,v 1.3 2004/11/22 06:28:53 cpressey Exp $ --- Test of automatically generated FSM's. - -require "fsm" - --- automatically create a finite state machine from the --- files in the same directory as this script, and --- manually start it: - -FSM.auto("start") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/middle.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/middle.lua deleted file mode 100644 index a9067a0a22..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/middle.lua +++ /dev/null @@ -1,9 +0,0 @@ --- $Id: middle.lua,v 1.5 2004/11/26 00:31:03 cpressey Exp $ - -return { - name = "middle", - action = function(fsm) - print("And this is the middle...") - return "sub-fsm" - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/start.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/start.lua deleted file mode 100644 index af57072a52..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/start.lua +++ /dev/null @@ -1,9 +0,0 @@ --- $Id: start.lua,v 1.4 2004/11/26 00:31:03 cpressey Exp $ - -return { - name = "start", - action = function(fsm) - print("This is the start.") - return "middle" - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm.lua deleted file mode 100644 index f861d563d2..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm.lua +++ /dev/null @@ -1,11 +0,0 @@ --- $Id: subfsm.lua,v 1.5 2005/01/25 05:07:07 cpressey Exp $ - -require "fsm" - -return { - name = "sub-fsm", - action = function(fsm) - App.descend("subfsm") - return "final" - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/main.lua deleted file mode 100644 index 14d18dc414..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/main.lua +++ /dev/null @@ -1,5 +0,0 @@ --- $Id: main.lua,v 1.2 2004/11/19 00:06:58 cpressey Exp $ - -require "fsm" - -FSM.auto("one") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/one.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/one.lua deleted file mode 100644 index 7fad27b793..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/one.lua +++ /dev/null @@ -1,9 +0,0 @@ --- $Id: one.lua,v 1.4 2004/11/26 00:31:03 cpressey Exp $ - -return { - name = "one", - action = function(fsm) - print("This is sub-state ONE.") - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/two.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/two.lua deleted file mode 100644 index ccd6e0d621..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/fsm/subfsm/two.lua +++ /dev/null @@ -1,9 +0,0 @@ --- $Id: two.lua,v 1.4 2004/11/26 00:31:03 cpressey Exp $ - -return { - name = "two", - action = function(fsm) - print("This is sub-state TWO.") - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/main.lua deleted file mode 100644 index fe90d3cb3a..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/main.lua +++ /dev/null @@ -1,113 +0,0 @@ --- $Id: main.lua,v 1.17 2004/11/17 01:00:21 cpressey Exp $ --- Lua LibDFUI Test Backend - -require "dfui" -require "gettext" - -function simple_menu_test() - r = c:present({ - id = "test", - name = _("Test Form"), - minimum_width = "78", - short_desc = _("This is a test form. Enter your birthdate in the fields provided below."), - actions = { - { - id = "ok", - name = _("OK"), - short_desc = _("Accept and Close"), - effect = function() - print(_("You selected 'OK'!")) - return "this-is-your-result:ok" - end - }, - { - id = "cancel", - name = _("Cancel"), - short_desc = _("Decline and Revert"), - effect = function() - print(_("You selected 'Cancel'!")) - return "this-is-your-result:cancel" - end - } - }, - fields = { - { id = "year", name = _("Year"), short_desc = _("Enter your year of birth") }, - { id = "month", name = _("Month"), short_desc = _("Enter your month of birth") }, - { id = "day", name = _("Day"), short_desc = _("Enter your day of birth"), - obscured = "true" } - }, - datasets = { - { year = "1967", month = "04", day = "23" } - } - }) - print("c:present()=", r) - print("r.form_id=", r.form_id) - print("r.action_id=", r.action_id) - print("r.result=", r.result) - print("r.datasets=", r.datasets) - for i = 1, table.getn(r.datasets) do - print("", i) - for k,v in r.datasets[i] do - print("", "", k, v) - end - end -end - -function typical_confirmation() - r = c:present({ - id = "confirmation", - name = _("Typical Confirmation"), - minimum_width = "78", - short_desc = _("Typical Confirmation Form"), - actions = { - { - id = "ok", - name = _("OK"), - short_desc = _("Typical Confirmation Form displayed"), - effect = function() - print(_("Typical Confirmation Form closed!")) - end - } - } - }) - print("c:present()=", r) - print("r.form_id=", r.form_id) - print("r.action_id=", r.action_id) -end - ---[[ MAIN ]]-- - -print("DFUIConnection=", DFUIConnection) -c = DFUIConnection.new("tcp", "9999") -print("c=", c) -r = c:start() -print("c:start()=", r) - -current_action="" - -done = false -while not done do - r = c:present({ - id = "libdfui_test", - name = _("LibDFUI Test Form"), - short_desc = _("This form will help you test LibDFUI"), - actions = { - { id = "simple_menu_test", name = _("Simple"), short_desc = _("Simple Menu Test") }, - { id = "typical_confirmation", name = _("Typical Confirmation"), short_desc = _("Typical Confirmation Form")}, - { id = "exit", name = _("Exit"), short_desc = _("Exit") } - }, - }) - print("r=", r) - for k,v in r do - print(k,"=",v) - end - if r.action_id == "simple_menu_test" then simple_menu_test() end - if r.action_id == "typical_confirmation" then typical_confirmation() end - if r.action_id == "exit" then done = true end -end - --- This will be done automatically when c is garbage-collected. --- However we can do it manually here as well. -r = c:stop() -print("c:stop()=", r) - diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu.lua deleted file mode 100644 index e7a67021df..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu.lua +++ /dev/null @@ -1,79 +0,0 @@ --- test/menu.lua --- $Id: menu.lua,v 1.5 2004/11/26 04:28:10 cpressey Exp $ --- Test of the DFUI Menu abstraction wrapper thing. - -require "dfui" - -local c = DFUIConnection.new("tcp", "9999") -c:start() - -local done = false - --- manually create a menu, --- manually populate it with items, and --- manually present it: - -menu = Menu.new(c, { - name = "My Menu", - short_desc = "This is my menu." -}) - -menu:add_item{ - name = "First Thing", - short_desc = "This is the first thing", - effect = function() - print("This is the 1st thing.") - end -} - -menu:add_item{ - name = "Second Thing", - short_desc = "This is the second thing", - effect = function() - print("This is the 2nd thing.") - end -} - -menu:add_item{ - name = "Third Thing", - short_desc = "This is the third thing", - effect = function() - print("This is the 3rd thing.") - end -} - --- Manually create and add a submenu - -submenu = Menu.new(c, { - name = "My Submenu", - short_desc = "This is a submenu" -}) - -submenu:add_item{ - name = "Foo", - effect = function() print("foo!") end -} -submenu:add_item{ - name = "Bar", - effect = function() print("bar!") end -} - -menu:add_item{ - name = "Submenu", - short_desc = "This item leads to a submenu", - effect = function() - submenu:present() - end -} - -menu:add_item{ - name = "Stop", - short_desc = "OK, enough of this", - effect = function() - done = true - end -} - -while not done do - menu:present() -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/010_first.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/010_first.lua deleted file mode 100644 index 7e4d968c13..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/010_first.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: 010_first.lua,v 1.4 2004/11/26 04:40:14 cpressey Exp $ - -return { - name = "First Thing", - short_desc = "This is the first thing", - effect = function() - print("This is the 1st thing.") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/020_second.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/020_second.lua deleted file mode 100644 index a4d1e9c147..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/020_second.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: 020_second.lua,v 1.4 2004/11/26 04:40:14 cpressey Exp $ - -return { - name = "Second Thing", - short_desc = "This is the second thing", - effect = function() - print("This is the 2nd thing.") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/030_third.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/030_third.lua deleted file mode 100644 index 0065500a15..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/030_third.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: 030_third.lua,v 1.4 2004/11/26 04:40:14 cpressey Exp $ - -return { - name = "Third Thing", - short_desc = "This is the third thing", - effect = function() - print("This is the 3rd thing.") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu.lua deleted file mode 100644 index 457f409244..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu.lua +++ /dev/null @@ -1,12 +0,0 @@ --- $Id: 500_submenu.lua,v 1.5 2005/01/25 05:07:07 cpressey Exp $ - -require "dfui" - -return { - name = "Enter Submenu", - short_desc = "Go into an automatically generated submenu", - effect = function() - App.descend("500_submenu") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/010_first.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/010_first.lua deleted file mode 100644 index cd25bc8c68..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/010_first.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: 010_first.lua,v 1.4 2004/11/26 04:40:14 cpressey Exp $ - -return { - name = "First SubThing", - short_desc = "This is the first subthing", - effect = function() - print("This is the 1st subthing.") - return Menu.CONTINUE - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/main.lua deleted file mode 100644 index 4338ad0695..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/500_submenu/main.lua +++ /dev/null @@ -1,10 +0,0 @@ --- $Id: main.lua,v 1.6 2005/02/02 22:26:20 cpressey Exp $ - -require "dfui" - -Menu.auto{ - name = "Submenu", - short_desc = - "This is a submenu automatically " .. - "created from a subdirectory." -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/main.lua deleted file mode 100644 index 4448d75e50..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/menu/main.lua +++ /dev/null @@ -1,23 +0,0 @@ --- $Id: main.lua,v 1.7 2005/02/02 22:26:20 cpressey Exp $ - -require "dfui" -require "app" - -App.start() - -Menu.auto{ - name = "Automatically Constructed Menu", - short_desc = - "This menu was automatically constructed from " .. - "the Lua script files in the same directory " .. - "as this Lua script file (scripts/test/menu.)", - exit_item = { - name = "Quit", - short_desc = "Quit this silly example program", - effect = function() - return Menu.DONE - end - } -} - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/network.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/network.lua deleted file mode 100644 index a91817e73c..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/network.lua +++ /dev/null @@ -1,16 +0,0 @@ --- $Id: network.lua,v 1.2 2005/02/23 23:07:01 cpressey Exp $ - -require "network" - -App.add_conf_path("./scripts/demo/conf") -- XXX BAD HACK -App.start() - -netif = NetworkInterface.all() - -for name, ni in netif do - print(name .. ":") - print("", "up = ", tostring(ni:is_up())) - print("", "inet = ", tostring(ni:get_inet_addr())) -end - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pipe.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pipe.lua deleted file mode 100644 index d1bd6d1329..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pipe.lua +++ /dev/null @@ -1,35 +0,0 @@ --- pipe.lua --- $Id: pipe.lua,v 1.4 2005/02/06 05:44:13 cpressey Exp $ --- Test of the libaura pipe binding. - -f = io.open("/tmp/foo.lua", "w") -f:write([[ -io.stdout:write("hello\n") -a = io.stdin:read("*l") -io.stdout:write("you said: <" .. a .. ">\n") -]]) -f:close() - -p = Pipe.open("lua /tmp/foo.lua") -p:write("no\n") -p:flush() - -line, err = p:readline() -while line do - print(line) - line, err = p:readline() -end - -reason = "UNKNOWN?!?" -if (err == Pipe.EOF) then reason = "end of file" end -if (err == Pipe.TIMEOUT) then reason = "timeout" end -if (err == Pipe.SELECT_ERR) then reason = "error from select()" end -if (err == Pipe.FGETS_ERR) then reason = "error from fgets()" end - -print("Stopped, reason: " .. reason) - -pstat = p:close() - -print("Status from p:close()=" .. pstat) - -os.execute("rm /tmp/foo.lua") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/progress.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/progress.lua deleted file mode 100644 index 47c72b8959..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/progress.lua +++ /dev/null @@ -1,30 +0,0 @@ --- $Id: progress.lua,v 1.4 2004/11/16 04:42:38 cpressey Exp $ - -require "dfui" - -c = DFUIConnection.new("tcp", "9999") -c:start() - -pr = DFUIProgress.new(c, - "Fake Progress", "Here is a progress bar that measures nothing", "") - -pr:start() - -desc = { - "Cabbage", "Celery", "Garbanzo Beans", "Radishes", "Corn", - "Iceberg Lettuce", "Asparagus", "Kidney Beans", "Snow Peas", "Broccoli" -} - -for i = 1, 10 do - pr:set_short_desc("Let's pretend we're installing: " .. desc[i]) - if not pr:update() then - print("user cancelled.") - break - end - os.execute("sleep 1") - pr:set_amount(i * 10) -end - -pr:stop() - -c:stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pty.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pty.lua deleted file mode 100644 index 36246fc3aa..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/pty.lua +++ /dev/null @@ -1,74 +0,0 @@ --- $Id: pty.lua,v 1.4 2005/04/03 20:28:22 cpressey Exp $ - -local Pty = require("pty") - -p, err = Pty.open("/usr/games/adventure") -print(p, err) - -input = { - "no", - "go building", - "get water", - "get keys", - "get food", - "get lantern", - "go out", - "go stream", - "s", - "quit", - "yes", - "ok" -} -i = 1 - -local read_until_timeout = function(p) - local acc, text, err - - acc = "" - text, err = p:read(100) - while err ~= Pty.TIMEOUT do - if err then - return acc, err - end - acc = acc .. text - text, err = p:read(100) - end - - return acc -end - -while true do - p:write(input[i] .. "\n") - t, err = read_until_timeout(p) - if t then - io.stdout:write(t) - end - if err == Pty.EOF then - break - end - if err then - print("ERROR: ", err) - end - i = i + 1 -end - -p:close() - -k = 0 -maxi = 100 --- Test for resource leakage. -for i = 1,maxi do - p, err = Pty.open("ls") - if p then - t, err = p:read() - print(t) - if p:close() then - k = k + 1 - --Clock.nanosleep(0.01) - print("closed #", k) - end - else - print("Cannot open pty: ", err) - end -end -print(k, "out of", maxi, "pty's opened and closed ok") diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/storage.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/storage.lua deleted file mode 100644 index e22b113bb5..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/storage.lua +++ /dev/null @@ -1,24 +0,0 @@ --- storage.lua --- $Id: storage.lua,v 1.3 2004/10/30 05:50:25 cpressey Exp $ --- Test of the storage library. - -require("storage") - -Storage.survey() - -print("System memory: " .. Storage.ram .. "MB") -print("# of disks: " .. table.getn(Storage.disk)) - -for disk_no, disk in Storage.disk do - print("Disk #" .. disk_no .. ":") - print(" Name: " .. disk.name) - print(" Description: " .. disk.desc) - print(" # of partitions: " .. table.getn(disk.slice)) - for slice_no, slice in disk.slice do - print(" Partition #" .. slice_no .. ":") - print(" Start: " .. slice.start) - print(" Size: " .. slice.size) - print(" Type: " .. slice.sysid) - print(" Flags: " .. slice.flags) - end -end diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/wait_for.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/wait_for.lua deleted file mode 100644 index 92e3116016..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/scripts/test/wait_for.lua +++ /dev/null @@ -1,20 +0,0 @@ --- $Id: wait_for.lua,v 1.1 2005/02/01 22:10:14 cpressey Exp $ - -require "app" - -App.start{ - name = "wait_for test program", - logfile = "wait_for.log" -} - -os.execute("rm -f /tmp/foo") -os.execute("sleep 10 && touch /tmp/foo &") - -local ok, t = App.wait_for{ - predicate = function() - return FileSystem.is_file("/tmp/foo") - end -} -App.log("App.wait_for() returned %s, %d", tostring(ok), t) - -App.stop() diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/200_select_disk.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/200_select_disk.lua deleted file mode 100644 index 881801a713..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/200_select_disk.lua +++ /dev/null @@ -1,40 +0,0 @@ --- $Id: 200_select_disk.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -return { - name = "select_disk", - title = "Select Disk", - action = function(fsm) - App.state.sel_disk = nil - App.state.sel_part = nil - - -- XXX there might be a better place to handle this. - if App.state.storage:get_disk_count() == 0 then - App.ui:inform(_( - "The installer could not find any suitable disks " .. - "attached to this computer. If you wish to " .. - "upgrade an installation located " .. - "on an unorthodox storage device, you will have to " .. - "exit to a LiveCD command prompt and configure it " .. - "manually, using the file /README as a guide.", - App.os.name) - ) - return nil - end - - local dd = StorageUI.select_disk({ - sd = App.state.storage, - short_desc = _( - "Select the disk on which the installation " .. - "that you wish to upgrade resides.", - App.os.name), - cancel_desc = _("Return to Main") -- _("Return to %s", fsm:prev().title) - }) - - if dd then - App.state.sel_disk = dd - return fsm:next() - else - return nil -- fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/300_select_part.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/300_select_part.lua deleted file mode 100644 index b7b9f0d258..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/300_select_part.lua +++ /dev/null @@ -1,26 +0,0 @@ --- $Id: 300_select_part.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -return { - name = "select_part", - title = "Select Partition", - action = function(fsm) - App.state.sel_part = nil - - local pd = StorageUI.select_part({ - dd = App.state.sel_disk, - short_desc = _( - "Select the primary partition of %s " .. - "on which the installation that " .. - "you wish to upgrade resides.", - App.state.sel_disk:get_name()), - cancel_desc = _("Return to %s", fsm:prev().title) - }) - - if pd then - App.state.sel_part = pd - return fsm:next() - else - return fsm:prev() - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/400_mount_target_system.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/400_mount_target_system.lua deleted file mode 100644 index a63eee8b98..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/400_mount_target_system.lua +++ /dev/null @@ -1,36 +0,0 @@ --- $Id: 400_mount_target_system.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -return { - name = "mount_target_system", - title = "Mount Target System", - action = function(fsm) - -- - -- If there is a target system mounted, unmount it before starting. - -- - if App.state.target ~= nil and App.state.target:is_mounted() then - if not App.state.target:unmount() then - App.ui:inform( - _("Warning: already-mounted target system could " .. - "not be correctly unmounted first.") - ) - return fsm:prev() - end - end - - App.state.target = TargetSystem.new(App.state.sel_part, "mnt") - if not App.state.target:probe() then - App.ui:inform(_( - "The target system could not be successfully probed." - )) - return fsm:prev() - end - if not App.state.target:mount() then - App.ui:inform(_( - "The target system could not be successfully mounted." - )) - return fsm:prev() - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/500_perform_upgrade.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/500_perform_upgrade.lua deleted file mode 100644 index 41df6b17d7..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/500_perform_upgrade.lua +++ /dev/null @@ -1,58 +0,0 @@ --- $Id: 500_perform_upgrade.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - --- --- Perform an upgrade by copying files from the root of the installation --- medium to the target system. --- -return { - name = "perform_upgrade", - title = "Perform Upgrade", - action = function(fsm) - local cmds - - assert(App.state.target) - cmds = CmdChain.new() - cmds:set_replacements{ - base = App.state.target:get_base() - } - - -- - -- First, we must record which files on the installed system have - -- the 'noschg' flag set. - -- - App.register_tmpfile("schg.txt") - cmds:add("${root}${FIND} ${root}${base} -flags -schg, >${tmp}schg.txt") - - -- - -- Next, we take away the schg flag from these files, so that we - -- can overwrite them. - -- - cmds:add("${root}${XARGS} -t ${root}${CHFLAGS} noschg <${tmp}schg.txt") - - -- - -- Add commands to copy sources (files and directories) now. - -- - App.state.target:cmds_install_srcs(cmds, App.load_conf("sources")) - - -- - -- Before we are done, we must use chflags to restore the flags - -- of files which we 'noschg'ed so that we could upgrade them. - -- - cmds:add("${root}${XARGS} -t ${root}${CHFLAGS} schg <${tmp}schg.txt") - - -- - -- Finally: do it. - -- - if cmds:execute() then - App.ui:inform( - _("Target system was successfully upgraded!") - ) - else - App.ui:inform( - _("Target system was not successfully upgraded.") - ) - end - - return fsm:next() - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/600_unmount_target_system.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/600_unmount_target_system.lua deleted file mode 100644 index 1a02b4c0ff..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/600_unmount_target_system.lua +++ /dev/null @@ -1,14 +0,0 @@ --- $Id: 600_unmount_target_system.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -return { - name = "unmount_target_system", - title = "Unmount Target System", - action = function(fsm) - if App.state.target:unmount() then - return fsm:next() - else - App.ui:inform("Target system could not be unmounted!") - return nil - end - end -} diff --git a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/main.lua b/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/main.lua deleted file mode 100644 index 62db83a442..0000000000 --- a/contrib/bsdinstaller-1.1.6/src/backend/lua/upgrade/main.lua +++ /dev/null @@ -1,3 +0,0 @@ --- $Id: main.lua,v 1.1 2005/03/27 23:19:29 cpressey Exp $ - -FSM.auto("select_disk") -- 2.41.0