]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c
added support for -i and -o for HII based configurations.
[mirror_edk2.git] / ShellPkg / Library / UefiShellInstall1CommandsLib / UefiShellInstall1CommandsLib.c
CommitLineData
75aadf59 1/** @file\r
2 Main file for NULL named library for install1 shell command functions.\r
3\r
2398d9b1 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
75aadf59 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "UefiShellInstall1CommandsLib.h"\r
16\r
17STATIC CONST CHAR16 mFileName[] = L"ShellCommands";\r
18EFI_HANDLE gShellInstall1HiiHandle = NULL;\r
19CONST EFI_GUID gShellInstall1HiiGuid = \\r
20 { \\r
21 0x7d574d54, 0xd364, 0x4d4a, { 0x95, 0xe3, 0x49, 0x45, 0xdb, 0x7a, 0xd3, 0xee } \\r
22 };\r
23\r
2398d9b1 24/**\r
25 Function to get the filename with help context if HII will not be used.\r
26\r
27 @return The filename with help text in it.\r
28**/\r
75aadf59 29CONST CHAR16*\r
30EFIAPI\r
31ShellCommandGetManFileNameInstall1 (\r
32 VOID\r
33 )\r
34{\r
35 return (mFileName);\r
36}\r
37\r
38/**\r
39 Constructor for the Shell Level 1 Commands library.\r
40\r
41 Install the handlers for level 1 UEFI Shell 2.0 commands.\r
42\r
43 @param ImageHandle the image handle of the process\r
44 @param SystemTable the EFI System Table pointer\r
45\r
46 @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r
47 @retval EFI_UNSUPPORTED the shell level required was not found.\r
48**/\r
49EFI_STATUS\r
50EFIAPI\r
51ShellInstall1CommandsLibConstructor (\r
52 IN EFI_HANDLE ImageHandle,\r
53 IN EFI_SYSTEM_TABLE *SystemTable\r
54 )\r
55{\r
56 //\r
57 // check our bit of the profiles mask\r
58 //\r
59 if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r
60 return (EFI_UNSUPPORTED);\r
61 }\r
62\r
63 gShellInstall1HiiHandle = HiiAddPackages (&gShellInstall1HiiGuid, gImageHandle, UefiShellInstall1CommandsLibStrings, NULL);\r
64 if (gShellInstall1HiiHandle == NULL) {\r
65 return (EFI_DEVICE_ERROR);\r
66 }\r
67\r
68 //\r
69 // install our shell command handlers that are always installed\r
70 //\r
71 ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfgInstall , ShellCommandGetManFileNameInstall1, 0, L"Install", FALSE, gShellInstall1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG));\r
72\r
73 return (EFI_SUCCESS);\r
74}\r
75\r
76/**\r
77 Destructor for the library. free any resources.\r
2398d9b1 78\r
79 @param ImageHandle The image handle of the process.\r
80 @param SystemTable The EFI System Table pointer.\r
75aadf59 81**/\r
82EFI_STATUS\r
83EFIAPI\r
84ShellInstall1CommandsLibDestructor (\r
85 IN EFI_HANDLE ImageHandle,\r
86 IN EFI_SYSTEM_TABLE *SystemTable\r
87 )\r
88{\r
89 if (gShellInstall1HiiHandle != NULL) {\r
90 HiiRemovePackages(gShellInstall1HiiHandle);\r
91 }\r
92 return (EFI_SUCCESS);\r
93}\r