When I went looking for commands to convert to the new jail strategy, I failed to find two. I have remedied that oversight now.
make showconfig
This command extracts the configuration items from the port. Like all the other scripts, it is fairly straight forward. The following is from make-showconfig.sh:
#!/bin/sh # # This extracts the config options for a given port. # # sudo /usr/sbin/chroot -u USER JAIL /make-showconfig.sh sysutils/bacula-client # # where USER - user as which to execute the commands. e.g. dan # JAIL - path to the jail created with the create-jail-directories.sh command. e.g. /usr/jail/FreshPorts # PORTDIR - sysutils/bacula-server # . ./vars.sh PORT=$1 cd ${PATHTOPORTS}/${PORT} ${MAKE} showconfig PORTSDIR=${PATHTOPORTS} OPTIONSFILE=${OPTIONSFILE} -f ${PATHTOPORTS}/${PORT}/Makefile
make master-sites-all
This command extracts the list of master sites. It’s from a script I named make-master-sites-all.sh:
#!/bin/sh # # This extracts the master port for a given port. # # sudo /usr/sbin/chroot -u USER JAIL /make-master-sites-all.sh sysutils/bacula-client # # where USER - user as which to execute the commands. e.g. dan # JAIL - path to the jail created with the create-jail-directories.sh command. e.g. /usr/jail/FreshPorts # PORTDIR - sysutils/bacula-server # . ./vars.sh PORT=$1 cd ${PATHTOPORTS}/${PORT} ${MAKE} master-sites-all PORTSDIR=${PATHTOPORTS} LOCALBASE=${LOCALBASE} -f ${PATHTOPORTS}/${PORT}/Makefile
Code changes
The code changes to use the above are, again, very simple.
$ cvs di -u cvs diff: Diffing . Index: config.pm.sample =================================================================== RCS file: /home/repositories/freshports-1/scripts/config.pm.sample,v retrieving revision 1.25 diff -u -r1.25 config.pm.sample --- config.pm.sample 30 Dec 2012 13:11:17 -0000 1.25 +++ config.pm.sample 30 Dec 2012 21:48:22 -0000 @@ -134,6 +134,8 @@ $FreshPorts::Config::JailCategoryDescrptionScript = '/make-category-comment.sh'; $FreshPorts::Config::JailPortScript = '/make-port.sh'; +$FreshPorts::Config::JailShowConfigScript = '/make-showconfig.sh'; +$FreshPorts::Config::JailMasterSitesScript = '/make-master-sites-all.sh'; $FreshPorts::Config::JailUser = 'dan'; 1; Index: port.pm =================================================================== RCS file: /home/repositories/freshports-1/scripts/port.pm,v retrieving revision 1.70 diff -u -r1.70 port.pm --- port.pm 30 Dec 2012 13:04:23 -0000 1.70 +++ port.pm 30 Dec 2012 21:48:22 -0000 @@ -502,8 +502,11 @@ if ($result == 0) { my $TmpFile = FreshPorts::Utilities::TmpFileName("$this->{category}.$this->{name}.make-mastersites-error"); print "trying to get master sites. Errors will be in '$TmpFile'\n"; - my $mastersitescommand = "make master-sites-all -f $Makefile PORTSDIR=$FreshPorts::Config::path_to_ports " . - "LOCALBASE=/nonexistentlocal 2>$TmpFile"; +# my $mastersitescommand = "make master-sites-all -f $Makefile PORTSDIR=$FreshPorts::Config::path_to_ports " . +# "LOCALBASE=/nonexistentlocal 2>$TmpFile"; + my $mastersitescommand = "/usr/local/bin/sudo /usr/sbin/chroot -u $FreshPorts::Config::JailUser $FreshPorts::Config::JailBaseDir $FreshPorts::Config::JailMasterSitesScript $this->{category}/$this->{name} 2>$TmpFile"; + + print "'$mastersitescommand'\n"; $mastersites = `$mastersitescommand`; # save this for later reference @@ -540,8 +543,10 @@ if ($result == 0) { my $TmpFile = FreshPorts::Utilities::TmpFileName("$this->{category}.$this->{name}.showconfig"); print "trying to get showconfig. Errors will be in '$TmpFile'\n"; - my $showconfigcommand = "make showconfig -f $Makefile PORTSDIR=$FreshPorts::Config::path_to_ports " . - "OPTIONSFILE=/nonexistent 2>$TmpFile"; +# my $showconfigcommand = "make showconfig -f $Makefile PORTSDIR=$FreshPorts::Config::path_to_ports " . +# "OPTIONSFILE=/nonexistent 2>$TmpFile"; + my $showconfigcommand = "/usr/local/bin/sudo /usr/sbin/chroot -u $FreshPorts::Config::JailUser $FreshPorts::Config::JailBaseDir $FreshPorts::Config::JailShowConfigScript $this->{category}/$this->{name} 2>$TmpFile"; + print "'$showconfigcommand'\n"; $showconfig = `$showconfigcommand`; # save this for later reference
This is sitting in my development website now. I’ll move it to beta soon.
Right now, I’m running a script to refresh all the ports in my dev website.
Now in production.