url2nc() {
local in="cat";
- [ -n "$@" ] && in="echo $@";
- $in | perl -MURI::Split -ne 'BEGIN{%port=("ssh"=>22,"https"=>443,"http"=>80);}; chomp($_); m,^\w+://, or $_="ssh://$_"; s,:([a-zAZ]),/$1,; @_=URI::Split::uri_split($_) or next; $_=$_[1]; s/^[^@]+@//; s/:/ / or $_.=" ".$port{$_[0]||"ssh"}; print "$_\n"'
+ [ -n "$*" ] && in="echo $*";
+ local IFS=$'\n'
+ eval $in | perl -MURI::Split -ne 'BEGIN{%port=("ssh"=>22,"https"=>443,"http"=>80);};
+ chomp($_);
+
+ if (/^([\.\w-_]+)\s+(\d+)$/) {
+ @_ = ($2,$1);
+ } else {
+ s,:([a-zAZ]),/$1,;
+ m,^\w+://, or $_="ssh://$_";
+ @_ = URI::Split::uri_split($_) or next;
+ }
+
+ $_=$_[1];
+ s/^[^@]+@//;
+
+ if ($_[0] =~ /^\d+$/) {
+ $_ .= " $_[0]";
+ } else {
+ s/:/ / or $_.=" ".$port{$_[0]||"ssh"};
+ }
+ print "$_\n"
+ '
}
sudo installer --verbose -pkg "${MOUNTDIR}/"*.pkg -target /
sudo hdiutil detach "${MOUNTDIR}"
}
+
+mac_keychain_add() {
+ local in="cat";
+ [ -n "$*" ] && in="echo $*";
+ eval $in | sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain
+}