VirtualBox

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

Last change on this file since 33656 was 33656, checked in by vboxsync, 14 years ago

*: rebrand Sun (L)GPL disclaimers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: VBoxExtPackHelperApp.cpp 33656 2010-11-01 14:18:11Z 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 * Oracle Corporation confidential
10 * All rights reserved
11 */
12
13
14/*******************************************************************************
15* Header Files *
16*******************************************************************************/
17#include "include/ExtPackUtil.h"
18
19#include <iprt/buildconfig.h>
20//#include <iprt/ctype.h>
21//#include <iprt/dir.h>
22//#include <iprt/env.h>
23//#include <iprt/file.h>
24#include <iprt/getopt.h>
25#include <iprt/initterm.h>
26#include <iprt/message.h>
27//#include <iprt/param.h>
28#include <iprt/path.h>
29//#include <iprt/pipe.h>
30#include <iprt/string.h>
31#include <iprt/stream.h>
32
33#include <VBox/log.h>
34#include <VBox/err.h>
35#include <VBox/version.h>
36
37
38/* Override RTAssertShouldPanic to prevent gdb process creation. */
39RTDECL(bool) RTAssertShouldPanic(void)
40{
41 return true;
42}
43
44
45/**
46 * Implements the 'install' command.
47 *
48 * @returns The program exit code.
49 * @param argc The number of program arguments.
50 * @param argv The program arguments.
51 */
52static RTEXITCODE DoInstall(int argc, char **argv)
53{
54 return RTEXITCODE_FAILURE;
55}
56
57/**
58 * Implements the 'uninstall' command.
59 *
60 * @returns The program exit code.
61 * @param argc The number of program arguments.
62 * @param argv The program arguments.
63 */
64static RTEXITCODE DoUninstall(int argc, char **argv)
65{
66 return RTEXITCODE_FAILURE;
67}
68
69
70int main(int argc, char **argv)
71{
72 int rc = RTR3Init();
73 if (RT_FAILURE(rc))
74 return RTMsgInitFailure(rc);
75
76 RTEXITCODE rcExit = RTEXITCODE_FAILURE;
77 if (argc > 1)
78 {
79 /*
80 * Command string switch.
81 */
82 if (!strcmp(argv[1], "install"))
83 rcExit = DoInstall(argc, argv);
84 else if (!strcmp(argv[1], "uninstall"))
85 rcExit = DoUninstall(argc, argv);
86 else
87 {
88 /*
89 * Didn't match a command, check for standard options.
90 */
91 RTGETOPTSTATE State;
92 rc = RTGetOptInit(&State, argc, argv, NULL, 0, 1, 0 /*fFlags*/);
93 if (RT_SUCCESS(rc))
94 {
95 for (;;)
96 {
97 RTGETOPTUNION ValueUnion;
98 int ch = RTGetOpt(&State, &ValueUnion);
99 switch (ch)
100 {
101 case 'h':
102 RTMsgInfo(VBOX_PRODUCT " Extension Pack Helper App\n"
103 "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n"
104 "All rights reserved.\n"
105 "\n"
106 "This NOT intended for general use, please use VBoxManage instead\n"
107 "or call the IExtPackManager API directly.\n"
108 "\n"
109 "Usage: %s <command> [options]\n"
110 "Commands:\n"
111 " install --basepath <dir> --name <name> --tarball <tarball> --tarball-fd <fd>\n"
112 " uninstall --basepath <dir> --name <name>\n"
113 , RTPathFilename(argv[0]));
114 rcExit = RTEXITCODE_SUCCESS;
115 break;
116
117 case 'V':
118 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
119 rcExit = RTEXITCODE_SUCCESS;
120 break;
121
122 default:
123 rcExit = RTGetOptPrintError(ch, &ValueUnion);
124 break;
125 }
126 }
127 }
128 else
129 RTMsgError("RTGetOptInit failed: %Rrc\n", rc);
130 }
131 }
132 else
133 RTMsgError("No command was specified\n");
134 return rcExit;
135}
136
Note: See TracBrowser for help on using the repository browser.

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