#!/usr/bin/perl -w if(require LWP::Simple) { use LWP::Simple; } use Cwd; $numofprogs = ''; $cwd = getcwd; system("which uudecode 2>/dev/null 1>/dev/null") and die "UUdecode package not found on system. Exiting...\n"; print "Welcome to Portable Apps for Linux App Downloader!\n\n"; print "Please wait while I download the package list...\n"; $address = "http://pafl.portools.com/api/packagelist"; $list = get($address); if(!$list) { system("lwp-download $address") and die "Could not download, exiting.\n"; open(A, "packagelist") or die "Could not open packagelist.\n"; $list = ; close A; unlink("packagelist"); } die "Could not download file after 2 tries, aborting.\n" unless $list; eval $list; print "Here are the apps: \n\n"; foreach(1..$numofprogs) { print "($_) -- $progs{$_}\n"; } print "Which app would you like to download(please type the number)? "; chomp($num = <>); $name = $progs{$num}; $url = ${$name}{'url'}; $description = ${$name}{'description'}; $size = ${$name}{'size'}; print "App $name:\n"; print " Size: $size KB\n"; print " Description: $description\n"; print "Download(y/n)?: "; chomp($ans = <>); exit if($ans eq 'n'); system("lwp-download $url") and die "Could not download. Exiting...\n"; print "What directory to extract to?[blank for current directory]: "; chomp($dir = <>); if(!$dir) { $dir = "."; } if(! -e $dir) { print "$dir does not exist. Creating...\n"; mkdir($dir) or die "$!\n"; } chdir($dir); print "Extracting...\n"; system("sh ${name}.sh") and die "Could not extract.\n"; chdir($cwd); unlink("$name.sh"); print "Complete. $name can be found at $dir/$name/$name.\n";