Beispiel #1
0
int main(void)
{
	// Set up the buffer and "switch" variables
	char command[50];
	char verify;
	char sudo;

	// Confirm update/upgrade
	printf("[pacupup] Update repos and upgrade the system using pacman? [y/N] [default: N] ");
	verify = verifyAction(getchar());

	if(verify > 0) {
		// Prompt for usage of sudo
		printf("[pacupup] Use sudo? [y/N] [default: y] ");
		sudo = sudoOption(getchar(), command);

		if(sudo > 0) {
			// Run the command using system()
			runSys(command);
		} else {
			return 1;
		}
	}

	return 0;
}
Beispiel #2
0
bool Driver::verifyActionQueue()
{
	if (! _initialised) initialise();

    logout << "Verifying queued actions" << endl;
    writeBuf();

	// read actions and execute
    int failures = 0;
    list<string>::iterator iter;
    _foreach(_actionQueue, iter) {
        string thisActionString = *iter;

        if (! verifyAction(thisActionString)) failures++;
    }