Changes between Version 2 and Version 3 of howto/AdvancedDailyAdm
- Timestamp:
- Apr 5, 2021, 10:51:18 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
howto/AdvancedDailyAdm
v2 v3 16 16 == The Scripts == 17 17 18 === Script 0: '''Default Values''' === 19 {{{ 20 declare prefix='/opt/local' 21 declare version='2.6.4' 22 }}} 23 18 24 === Script 1: '''Installation''' === 19 25 20 26 {{{ 21 #!/ bin/bash27 #!/usr/bin/env bash 22 28 23 29 ################################################################################ 24 30 # copyright Bjarne D Mathiesen 25 # K øbenhavn; Danmark ; Europa31 # Korsør ; Danmark ; Europa 26 32 # macintosh .at. mathiesen .dot. info 27 33 # date 04/07-2007 … … 32 38 # 18/06-2011 added default values for the parameters 33 39 # updated path values for XCode4 34 # 35 # this script is released under the BSD license 40 # 05/03-2017 added update to actions 41 # 31/01-2018 added checkpaths & fixpaths 42 # updated default values for the parameters 43 # 02/03-2021 removed fixpaths 44 # reworked setpaths 45 # added fixCLT 46 # 47 # this script is released under the OSS GPL v3 license 36 48 # the author welcomes feedback and improvements 37 49 # 50 ( cd $( dirname ${0} ) 51 52 source ./portDefaults 38 53 39 54 usage() { 40 55 cat <<EOT 41 56 purpose : to automate the whole install process 42 \${1} : action [ install (default) , paths ] 43 \${2} : install prefix ( default /macports ) 44 \${3} : macports base version ( default 1.9.2 ) 57 \${1} : action [ update (default) , install , setpaths , checkpaths , select , fixCLT ] 58 \${2} : macports base version ( default ${version} ) only for install 45 59 EOT 46 60 } 47 61 48 declare action=${1:-"install"} 49 declare prefix=${2:-"/macports"} 50 declare version=${3:-"1.9.2"} 62 declare action=${1:-"update"} 63 [ ! -z ${2} ] && declare version=${2} 51 64 52 65 case ${action} in 66 67 ######################## 68 # https://trac.macports.org/wiki/ProblemHotlist#reinstall-clt 69 ('fixCLT') 70 touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress 71 softwareupdate -ia 72 rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress 73 74 ;; 75 ######################## 76 # 77 ('select') 78 while read -u 9 name selected options 79 do 80 options=( $( echo ${options} ) ) 81 port select --set "${name}" ${options[@]: -2:1} 82 done 9< <( port -q select --summary ) 83 port select --summary 84 85 ;; 86 ######################## 87 # update installed ports 88 ('update') 89 port -dN selfupdate 90 port outdated 91 port clean --work outdated 92 port -cuNp upgrade outdated 93 port -pN clean --work installed 94 # port -pN reclaim 95 96 ;; 53 97 ######################## 54 98 # setup the system paths 55 'paths')99 ('setpaths') 56 100 57 101 mkdir -p /etc/paths.d … … 60 104 touch /etc/paths 61 105 62 echo "${prefix}/bin" > /etc/paths.d/000macports 63 echo "${prefix}/sbin" >> /etc/paths.d/000macports 64 65 echo "/Developer/usr/bin" > /etc/paths.d/888developer 66 echo "/Developer/usr/sbin" >> /etc/paths.d/888developer 106 echo "${prefix}/bin" > /etc/paths 107 echo "${prefix}/sbin" >> /etc/paths 108 109 echo "/Applications/Xcode.app/Contents/Developer/usr/bin" > /etc/paths.d/888developer 67 110 68 111 mkdir -p /etc/manpaths.d … … 72 115 73 116 echo "${prefix}/share/man" > /etc/manpaths.d/000macports 74 echo "/Developer/usr/share/man" > /etc/manpaths.d/888developer 75 echo "/Developer/usr/X11/share/man" >> /etc/manpaths.d/888developer 76 77 # path_helper is buggy under 10.5 78 #cp -npv /usr/libexec/path_helper /usr/libexec/path_helper.orig 79 #cp -v path_helper /usr/libexec/ 117 #echo "/Developer/usr/share/man" > /etc/manpaths.d/888developer 118 #echo "/Developer/usr/X11/share/man" >> /etc/manpaths.d/888developer 119 120 ;; 121 ######################## 122 # check the system paths 123 ('checkpaths') 124 /usr/libexec/path_helper 80 125 81 126 ;; 82 127 ################## 83 128 # install macports 84 'install')129 ('install') 85 130 86 131 if [ ! -e MacPorts-${version}.tar.gz ] 87 132 then 88 curl -O --url "http ://distfiles.macports.org/MacPorts/MacPorts-${version}.tar.gz"133 curl -O --url "https://distfiles.macports.org/MacPorts/MacPorts-${version}.tar.gz" 89 134 fi 90 135 … … 93 138 94 139 cd MacPorts-${version} 95 ./configure LDFLAGS=-L/Developer/SDKs/MacOSX10.6.sdk/usr/X11/lib --prefix=${prefix} 140 #patch -p0 </Volumes/Bjarne/WebServer/MacPorts/newPorts/pathces/mp-base-no-progress-if-stdout-no-tty.patch 141 #./configure LDFLAGS=-L/Developer/SDKs/MacOSX10.6.sdk/usr/X11/lib --prefix=${prefix} 142 ./configure --prefix=${prefix} 96 143 make 97 144 make install 98 145 99 146 # update MacPorts itself 100 ${prefix}/bin/port -d selfupdate 101 102 # let's get bash 103 ${prefix}/bin/port install bash 147 ${prefix}/bin/port -dN selfupdate 148 149 # let's get bash, zsh & nano 150 ${prefix}/bin/port -N install bash zsh nano 151 152 # cleanup 153 rm -rf ./MacPorts-${version} 104 154 105 155 ;; 106 156 # default 107 *)157 (*) 108 158 usage 109 159 esac 160 161 ) ; wait 110 162 }}} 111 163