portfix 4.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# The template
#
use strict;
use libinstall;
use installvars;

sub Install($$$)
{
    my ($server, $isupdate, $impotent) = @_;

    # Replace if this script does an update for ip/domain.
    return 0
	if ($isupdate);

    Phase "portfixup", "Fixing up packages", sub {
	Phase "rsync", "Looking for rsync", sub {
18
	    DoneIfPackageInstalled("rsync");
19
	    my $pname = GetPackage("rsync", $packagedir);
20
	    AddPackage($pname, $packagedir);
21 22 23 24
	};
	if ($FBSD_MAJOR >= 6) {
	    # Temporary for template stuff
	    Phase "Simple", "Looking for Simple XML Parser", sub {
25
		DoneIfPackageInstalled("p5-XML-Simple");
26
		my $pname = GetPackage("p5-XML-Simple", $packagedir);
27
		AddPackage($pname, $packagedir);
28 29 30
	    };
	    if ($ARCHSUPPORT) {
		Phase "Subversion", "Looking for Subversion", sub {
31
		    DoneIfPackageInstalled("subversion");
32 33 34 35 36 37
		    my $pname;
		    if ($FBSD_MAJOR > 6) {
			$pname = GetPackage("py-subversion", $packagedir);
		    } else {
			$pname = GetPackage("subversion-python", $packagedir);
		    }
38
		    AddPackage($pname, $packagedir);
39 40 41 42 43
		};
	    }
	}
	if ($WINSUPPORT) {
	    Phase "gcc30", "Looking for GCC 3.0 and installing", sub {
44 45
		if ($FBSD_MAJOR > 4) {
		    PhaseSkip("not needed");
46
		}
47
		DoneIfPackageInstalled("gcc30");
48
		my $pname = GetPackage("gcc30", $packagedir);
49
		AddPackage($pname, $packagedir);
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
	    };
	}
	if ($FBSD_MAJOR > 6) {
	    #
	    # What a crock!  First, that the FreeBSD ports system
	    # defaults to installing the zipped .egg files that have
	    # to be unzipped per-user before use.  Second, that it
	    # offers no easy way at package creation to override this.
	    # Third, that there is no easy way that I could find in
	    # the python eggs system to set a global cache directory
	    # into which to unpack all eggs; you have to set
	    # PYTHON_EGG_CACHE in the environment of every script.
	    # Fourth, that the per-user default value might be in an
	    # unwritable location.
	    #
	    # So, I am reduced to manually unpacking all .egg files
	    # into the corresponding .egg directories after the
	    # install!  Since this would totally screw any attempt
	    # to update those packages, I just do it to the one
	    # package that I know will fail otherwise.
	    #
	    Phase "m2crypto-egg", "Unpacking python m2crypto .egg", sub {
		my $pydir = "/usr/local/lib/$PY_VER/site-packages";
		my $egg = `ls -d $pydir/M2Crypto-*-py*-*.egg 2>/dev/null | tail -1`;
		chomp($egg);
		if ($egg eq "") {
		    PhaseSkip("egg not found");
		}
		if (-d "$egg") {
		    PhaseSkip("egg already unpacked");
		}
81 82 83
		if (! -x $EASYINSTALL) {
		    PhaseSkip("python easy_install missing");
		}
84 85 86 87
		# XXX swig must be installed for easyinstall to exit correctly
		Phase "swig", "Installing swig", sub {
		    DoneIfPackageInstalled("swig");
		    my $pname = GetPackage("swig", $packagedir);
88
		    AddPackage($pname, $packagedir);
89 90 91 92 93 94 95
		};
		ExecQuietFatal("mv $egg /var/tmp/");
		$egg =~ s/$pydir//;
		ExecQuietFatal("$EASYINSTALL -N -H None -Z /var/tmp$egg");
		ExecQuietFatal("mv /var/tmp$egg $pydir/$egg.bak");
	    };
	}
96 97 98 99 100 101 102 103 104 105 106
	if ($FBSD_MAJOR == 9) {
	    #
	    # Ports that were added after the 9.0 packages were made.
	    # As of 05/2014, the 9.0 stuff is still needed on geniracks.
	    #
	    Phase "p5-Net-IP", "Looking for p5-Net-IP and installing", sub {
		DoneIfPackageInstalled("p5-Net-IP");
		my $pname = GetPackage("p5-Net-IP", $packagedir);
		AddPackage($pname, $packagedir);
	    };
	    Phase "p5-JSON", "Looking for p5-JSON and installing", sub {
107 108
		DoneIfPackageInstalled("p5-JSON");
		my $pname = GetPackage("p5-JSON", $packagedir);
109 110 111
		AddPackage($pname, $packagedir);
	    };
	}
112 113 114 115 116 117 118 119 120
	if ($FBSD_MAJOR >= 10) {
	    Phase "bind-compat", "Creating /etc/namedb for backward compat", sub {
		PhaseSkip("already exists")
		    if (-e "/etc/namedb");
		PhaseSkip("bind not installed?")
		    if (! -d "/usr/local/etc/namedb");
		ExecQuietFatal("ln -sf /usr/local/etc/namedb /etc/namedb");
	    };
	}
121 122
	if ($PGENISUPPORT) {
	    Phase "mod_wsgi3", "Looking for mod_wsgi3 and installing", sub {
123 124
		DoneIfPackageInstalled("ap22-mod_wsgi");
		my $pname = GetPackage("ap22-mod_wsgi", $packagedir);
125
		AddPackage($pname, $packagedir);
Mike Hibler's avatar
Mike Hibler committed
126
	    };
127
	    Phase "py-flask", "Looking for py-flask and installing", sub {
128 129
		DoneIfPackageInstalled("py27-Flask");
		my $pname = GetPackage("py27-Flask", $packagedir);
130
		AddPackage($pname, $packagedir);
Mike Hibler's avatar
Mike Hibler committed
131
	    };
132
	}
133 134 135 136 137 138 139 140
    };

    return 0;
}

# Local Variables:
# mode:perl
# End: