VirtualBox

source: vbox/trunk/src/VBox/Main/VBoxExtPackHelperApp.cpp@ 33623

最後變更 在這個檔案從33623是 33623,由 vboxsync 提交於 14 年 前

ExtPack: More code.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.4 KB
 
1/* $Id: VBoxExtPackHelperApp.cpp 33623 2010-10-29 16:16:06Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Extension Pack Helper Application, usually set-uid-to-root.
4 */
5
6/*
7 * Copyright (C) 2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include "include/ExtPackUtil.h"
23
24#include <iprt/buildconfig.h>
25//#include <iprt/ctype.h>
26//#include <iprt/dir.h>
27//#include <iprt/env.h>
28//#include <iprt/file.h>
29#include <iprt/getopt.h>
30#include <iprt/initterm.h>
31#include <iprt/message.h>
32//#include <iprt/param.h>
33#include <iprt/path.h>
34//#include <iprt/pipe.h>
35#include <iprt/string.h>
36#include <iprt/stream.h>
37
38#include <VBox/log.h>
39#include <VBox/err.h>
40#include <VBox/version.h>
41
42
43/* Override RTAssertShouldPanic to prevent gdb process creation. */
44RTDECL(bool) RTAssertShouldPanic(void)
45{
46 return true;
47}
48
49
50/**
51 * Implements the 'install' command.
52 *
53 * @returns The program exit code.
54 * @param argc The number of program arguments.
55 * @param argv The program arguments.
56 */
57static RTEXITCODE DoInstall(int argc, char **argv)
58{
59 return RTEXITCODE_FAILURE;
60}
61
62/**
63 * Implements the 'uninstall' command.
64 *
65 * @returns The program exit code.
66 * @param argc The number of program arguments.
67 * @param argv The program arguments.
68 */
69static RTEXITCODE DoUninstall(int argc, char **argv)
70{
71 return RTEXITCODE_FAILURE;
72}
73
74
75int main(int argc, char **argv)
76{
77 int rc = RTR3Init();
78 if (RT_FAILURE(rc))
79 return RTMsgInitFailure(rc);
80
81 RTEXITCODE rcExit = RTEXITCODE_FAILURE;
82 if (argc > 1)
83 {
84 /*
85 * Command string switch.
86 */
87 if (!strcmp(argv[1], "install"))
88 rcExit = DoInstall(argc, argv);
89 else if (!strcmp(argv[1], "uninstall"))
90 rcExit = DoUninstall(argc, argv);
91 else
92 {
93 /*
94 * Didn't match a command, check for standard options.
95 */
96 RTGETOPTSTATE State;
97 rc = RTGetOptInit(&State, argc, argv, NULL, 0, 1, 0 /*fFlags*/);
98 if (RT_SUCCESS(rc))
99 {
100 for (;;)
101 {
102 RTGETOPTUNION ValueUnion;
103 int ch = RTGetOpt(&State, &ValueUnion);
104 switch (ch)
105 {
106 case 'h':
107 RTMsgInfo(VBOX_PRODUCT " Extension Pack Helper App\n"
108 "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n"
109 "All rights reserved.\n"
110 "\n"
111 "This NOT intended for general use, please use VBoxManage instead\n"
112 "or call the IExtPackManager API directly.\n"
113 "\n"
114 "Usage: %s <command> [options]\n"
115 "Commands:\n"
116 " install --basepath <dir> --name <name> --tarball <tarball> --tarball-fd <fd>\n"
117 " uninstall --basepath <dir> --name <name>\n"
118 , RTPathFilename(argv[0]));
119 rcExit = RTEXITCODE_SUCCESS;
120 break;
121
122 case 'V':
123 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
124 rcExit = RTEXITCODE_SUCCESS;
125 break;
126
127 default:
128 rcExit = RTGetOptPrintError(ch, &ValueUnion);
129 break;
130 }
131 }
132 }
133 else
134 RTMsgError("RTGetOptInit failed: %Rrc\n", rc);
135 }
136 }
137 else
138 RTMsgError("No command was specified\n");
139 return rcExit;
140}
141
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette