47 | | |
48 | | === Convert myports.txt into an install script (EXPERIMENTAL) === #sed_script |
49 | | |
50 | | These sed scripts will get close to coverting myports.txt into an installation script. It will not arrange the order of the installation according to the dependency tree and it cannot check the most recent variants against those of the installed ports. It will strip away any variants with '+darwin*', '+macosx' or '+i386', because any platform or architecture variants should be determined automatically. The {{{myports.bash}}} file should be reviewed carefully and the variant specifications should be compared with the output from {{{port variants <aPort>}}}. Some ports may have a long list of +variant options, but they might all be replaced with a {{{+huge}}} variant. Also look for duplicate ports with different versions, some of them might not be required (e.g., {{{docbook-xml-*}}}). |
51 | | |
52 | | The following will output {{{myports.bash}}} with {{{'&& \'}}} at the end of each command line. This will effectively create one long command line, with contingent installation of successive ports. Should any one port fail to install, no others will run (e.g., try {{{ls abc.txt && cat abc.txt}}} in a directory where no file exists called {{{abc.txt}}}). When a port fails to install, the {{{myports.bash}}} script can be edited to remove all the prior ports that are already installed. |
53 | | |
54 | | {{{ |
55 | | $ cat myports.txt | /usr/bin/sed \ |
56 | | -e 's/@[._0-9a-zA-Z\-]*+/+/' \ |
57 | | -e 's/@[._0-9a-zA-Z \-]*(active)//' \ |
58 | | -e 's/(active)//' \ |
59 | | -e 's/+/ +/g' \ |
60 | | -e 's/[+]darwin[_i0-9]*//g' \ |
61 | | -e 's/+macosx//g' \ |
62 | | -e 's/+i386//g' \ |
63 | | -e 's/+gcc[0-9]*//' \ |
64 | | -e 's/$/ \&\& \\/' \ |
65 | | -e 's/^./sudo port install /' \ |
66 | | -e 's/.*currently installed:.*/#!\/bin\/bash/' \ |
67 | | > myports.bash |
68 | | $ chmod +x myports.bash |
69 | | $ # Remove the '&& \' from the last line of the file. |
70 | | $ ./myports.bash |
71 | | }}} |
72 | | |
73 | | This is another possibility, which will list all the ports on one {{{sudo port install}}} command, rather than a separate command for each port. |
74 | | |
75 | | {{{ |
76 | | $ cat myports.txt | /usr/bin/sed \ |
77 | | -e 's/@[._0-9a-zA-Z\-]*+/+/' \ |
78 | | -e 's/@[._0-9a-zA-Z \-]*(active)//' \ |
79 | | -e 's/(active)//' \ |
80 | | -e 's/+/ +/g' \ |
81 | | -e 's/[+]darwin[_i0-9]*//g' \ |
82 | | -e 's/+macosx//g' \ |
83 | | -e 's/+i386//g' \ |
84 | | -e 's/+gcc[0-9]*//' \ |
85 | | -e '$q;s/$/ \\/' \ |
86 | | -e 's/.*currently installed:.*/#!\/bin\/bash/' \ |
87 | | -e '/\bin\/bash/ a\ |
88 | | sudo port install \\ |
89 | | ' > myports.bash |
90 | | $ chmod +x myports.bash |
91 | | $ ./myports.bash |
92 | | }}} |