#!/usr/local/bin/perl # # This script prepares a Solaris box to be used for Zimbra development # by installing all necessary packages and setting up appropriate environment # variables. It only needs to be run once, but won't cause any damage if it's # accidentally run again $pkggeturl = "http://www.blastwave.org/pkg_get.pkg"; $cswmirror = "http://ftp.math.purdue.edu/mirrors/blastwave.org/stable"; # Packages from Blastwave to install $pkgs = "common gnupg textutils wget gmake gtar lynx libgmp curl autoconf automake libxml2 groff gsed gawk sudo subversion pcre gcc3 gcc3g++ libtool ant"; # Must run as root if ($> ne 0) { print "Must run as root\n"; exit 1; } print <> /etc/passwd"); system("echo 'zimbra:NP:13689::::::' >> /etc/shadow"); } print "Checking for Zimbra group.."; $z = `egrep \"^zimbra\" /etc/group`; if ($z) { print "found\n"; } else { print "not found. Creating\n"; system("echo 'zimbra::160:' >> /etc/group"); } } sub do_environment { # Check for certain variables in /etc/profile and set them if they're not already there print "Checking /etc/profile.."; $z = `egrep \"^ANT_HOME\" /etc/profile`; if ($z) { print "Good\n"; } else { print "Appending.."; if (open (PRO,">>/etc/profile")) { print PRO <; chomp $rc; if ($rc eq "") {return $default;} return $rc; } sub askYN { my $prompt = shift; my $default = shift; while (1) { my $v = ask($prompt, $default); $v = lc($v); $v = substr ($v,0,1); if ($v eq "y") {return "yes";} if ($v eq "n") {return "no";} print "A Yes/No answer is required\n"; } }