#!/usr/bin/perl -w
use strict;
use warnings;
sub menu {
	my ($parameter) = @_;
	system ("clear");
	if ($parameter) {
	print "Bitte nur die angegeben Möglichkeiten nutzen!\n\n";
        }
	print "WINE-Installation aus dem GIT-Repository\n";
	print "----------------------------------------\n";
	print "Möchten Sie:\n";
	print "a) einen vorhandenen GIT WINE-Ordner löschen\n";
	print "b) einen vorhandenen GIT WINE-Ordner verschieben\n";
	print "c) WINE GIT deinstallieren\n";
        print "d) einen vorhandenen .wine Ordner mit Programmen und Einstellungen sichern\n";
	print "e) mit dem Script fortfahren\n";
	print "----------------------------------------\n";
	print "q) das Script beenden\n\n";
	print "Ihre Eingabe: ";
	chomp(my $user_input = <STDIN>);
	if (lc $user_input eq "a") {
	system ("rm -rI wine");
        }
	elsif (lc $user_input eq "b") {
	system ("mv wine wine.old");
        }
        elsif (lc $user_input eq "c") {
	system ("cd wine && make uninstall");
        }
	elsif (lc $user_input eq "d") {
	system ("mv .wine .winebackup");
        }
	elsif (lc $user_input eq "e") {
	print "done\n";
        }
	elsif (lc $user_input eq "q") {
	system ("clear");
	exit;
        }
	else {
	menu("error");
	       }
	}
menu();
system ("yum install git libstdc++ cpp gcc make libgcc gcc-c++ bison flex alsa-lib-devel arts-devel audiofile-devel esound-devel freeglut-devel lcms-devel libieee1284-devel libjpeg-devel libstdc++-devel libusb-devel libxml2-devel libxslt-devel ncurses-devel openldap-devel sane-backends-devel zlib-devel desktop-file-utils fontforge gphoto2 gphoto2-devel isdn4k-utils-devel libX11-devel mesa-libGL-devel mesa-libGLU-devel libXxf86dga-devel libXxf86vm-devel libXrandr-devel libXrender-devel libXext-devel libXinerama-devel fontconfig-devel giflib-devel cups-devel libXmu-devel libXi-devel dbus-devel hal-devel\n");
system ("git clone git://source.winehq.org/git/wine.git wine");
chdir ("wine");
system ("./configure");
system ("make");
system ("make install");
