-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bash_profile.Darwin
61 lines (49 loc) · 3.21 KB
/
.bash_profile.Darwin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# vim: ft=bash noet:
! declare 2>&1 | grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
trap 'echo "=> Ignoring this step and continuing the script <$(basename $BASH_SOURCE)> ..." >&2' INT
test -n "$system" || declare -gxr system="$(sw_vers -productName) $(sw_vers -productVersion)"
duExcludedPathList="./proc ./sys ./dev"
excludePathsDuExpression=$(printf -- "--exclude %s " $duExcludedPathList)
findExcludedPathList="./proc ./sys ./dev"
findPrunePathsExpression="( -type d -a ( -name .git $(printf -- " -o -path %s" $findExcludedPathList) ) ) -prune -o"
#codeName=$(\sed -nE '/SOFTWARE LICENSE AGREEMENT FOR/s/([A-Za-z]+ ){5}|\\$//gp' /System/Library/CoreServices/Setup\ Assistant.app/Contents/Resources/en.lproj/OSXSoftwareLicense.rtf)
grep=ggrep
codeName=$($grep -o -P '((\w+)\s){2}LICENSE\s(\w+)\sFOR\s\K(\w+)\s(\w+)' '/System/Library/CoreServices/Setup Assistant.app/Contents/Resources/en.lproj/OSXSoftwareLicense.rtf')
if [ -x /usr/local/opt/gnu-getopt/bin/getopt ];then
# export PATH="$PATH:/usr/local/opt/gnu-getopt/bin" # cf. brew link gnu-getopt
export getopt=/usr/local/opt/gnu-getopt/bin/getopt
fi
#Creation du .cache dans "/tmp/$USER/" ssi le lien symbolique ~/.cache existe
cacheLinkName=.cache
if [ -L $HOME/Library/$cacheLinkName ];then
test ! -d /tmp/$USER/$cacheLinkName && mkdir -pv /tmp/$USER/$cacheLinkName
tty -s && echo && cd && ls -ld -G Library/$cacheLinkName | awk '{print$(NF-2)" "$(NF-1)" "$NF}'
cd - >/dev/null
fi
mkdir -p ~/log
if ! groups | \egrep -wq "sudo|adm|root|admin"
then
test -z $HOMEBREW_PREFIX && export HOMEBREW_CASK_OPTS="--appdir=$HOME/Applications" || export HOMEBREW_CASK_OPTS="--appdir=$HOMEBREW_PREFIX"
fi
#Stops XQuartz from starting a new terminal window when it starts
defaults read org.macosforge.xquartz.X11 app_to_run | grep -q bin/true$ || defaults write org.macosforge.xquartz.X11 app_to_run $(type -P true)
#test "$SSH_CONNECTION" || pgrep -fu $USER XQuartz.app >/dev/null || ( echo "=> Starting XQuartz.app ..." | tee -a ~/log/XQuartz.log ;nohup /Applications/Utilities/XQuartz.app/Contents/MacOS/X11.bin >>~/log/XQuartz.log 2>&1 & )
if which XQuartz.app >/dev/null 2>&1 && ! test "$SSH_CONNECTION";then
pgrep -fu $USER XQuartz.app >/dev/null || ( echo "=> Starting XQuartz ..." && command open -a XQuartz )
fi
#echo $DISPLAY | grep -q ^/private/tmp && export DISPLAY=:0
# Tu use the Picoscobe drivers with "https://github.com/colinoflynn/pico-python/" PicoScope Python Interface
test -d /Applications/PicoScope6.app/Contents/Resources/lib && export DYLD_LIBRARY_PATH=/Applications/PicoScope6.app/Contents/Resources/lib
#Impression a partir de CUPS/Lpr + gs
if ! grep -q "Sandboxing Relaxed" /etc/cups/cups-files.conf && groups | \egrep -wq "sudo|adm|root"
then
echo Sandboxing Relaxed | sudo tee -a /etc/cups/cups-files.conf
launchctl stop org.cups.cupsd
launchctl start org.cups.cupsd
cupsctl WebInterface=yes
fi
#pgrep -qfu $USER XQuartz.app && tty -s && echo "=> MIT-MAGIC-COOKIE-1:" && xauth list | grep :$(echo $DISPLAY | awk -F '\\.|:' '{print$2}') && echo
trap - INT
set +x
test "$debug" -gt 0 && echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"