/* $Id: VBoxExtPackHelperApp.cpp 33656 2010-11-01 14:18:11Z vboxsync $ */ /** @file * VirtualBox Main - Extension Pack Helper Application, usually set-uid-to-root. */ /* * Copyright (C) 2010 Oracle Corporation * * Oracle Corporation confidential * All rights reserved */ /******************************************************************************* * Header Files * *******************************************************************************/ #include "include/ExtPackUtil.h" #include //#include //#include //#include //#include #include #include #include //#include #include //#include #include #include #include #include #include /* Override RTAssertShouldPanic to prevent gdb process creation. */ RTDECL(bool) RTAssertShouldPanic(void) { return true; } /** * Implements the 'install' command. * * @returns The program exit code. * @param argc The number of program arguments. * @param argv The program arguments. */ static RTEXITCODE DoInstall(int argc, char **argv) { return RTEXITCODE_FAILURE; } /** * Implements the 'uninstall' command. * * @returns The program exit code. * @param argc The number of program arguments. * @param argv The program arguments. */ static RTEXITCODE DoUninstall(int argc, char **argv) { return RTEXITCODE_FAILURE; } int main(int argc, char **argv) { int rc = RTR3Init(); if (RT_FAILURE(rc)) return RTMsgInitFailure(rc); RTEXITCODE rcExit = RTEXITCODE_FAILURE; if (argc > 1) { /* * Command string switch. */ if (!strcmp(argv[1], "install")) rcExit = DoInstall(argc, argv); else if (!strcmp(argv[1], "uninstall")) rcExit = DoUninstall(argc, argv); else { /* * Didn't match a command, check for standard options. */ RTGETOPTSTATE State; rc = RTGetOptInit(&State, argc, argv, NULL, 0, 1, 0 /*fFlags*/); if (RT_SUCCESS(rc)) { for (;;) { RTGETOPTUNION ValueUnion; int ch = RTGetOpt(&State, &ValueUnion); switch (ch) { case 'h': RTMsgInfo(VBOX_PRODUCT " Extension Pack Helper App\n" "(C) " VBOX_C_YEAR " " VBOX_VENDOR "\n" "All rights reserved.\n" "\n" "This NOT intended for general use, please use VBoxManage instead\n" "or call the IExtPackManager API directly.\n" "\n" "Usage: %s [options]\n" "Commands:\n" " install --basepath --name --tarball --tarball-fd \n" " uninstall --basepath --name \n" , RTPathFilename(argv[0])); rcExit = RTEXITCODE_SUCCESS; break; case 'V': RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision()); rcExit = RTEXITCODE_SUCCESS; break; default: rcExit = RTGetOptPrintError(ch, &ValueUnion); break; } } } else RTMsgError("RTGetOptInit failed: %Rrc\n", rc); } } else RTMsgError("No command was specified\n"); return rcExit; }