<commit_before>#!/usr/bin/env bash

firmwareversion=$(defaults read loginwindow SystemVersionStampAsString | cut -d. -f2- | cut -f1,1 -d'.';);
[ ${firmwareversion} -ge 11 ] && SIPstatus=$(csrutil status | sed -E 's/.*(...abled).*/\1/g';);
filenameextension='pkg';
[ ${firmwareversion} -eq 5 ] && softwarelatestversion='1.1' && filenameextension="${filenameextension/#/m}";
[ ${firmwareversion} -eq 6 ] && softwarelatestversion='1.3';
[ ${firmwareversion} -eq 7 ] && softwarelatestversion='1.4.11';
[ ${firmwareversion} -eq 8 ] && softwarelatestversion='1.5.4';
[ ${firmwareversion} -ge 9 -a ${firmwareversion} -le 12 ] && softwarelatestversion='1.6';
n=$[RANDOM%99+1] && while [ -e /Users/${USER}/Temporary/Folder${n} ]; do n=$[RANDOM%99+1]; done # so there's no risk that the temporary directory exists and has contents, thus it spares from theneed to check this.
workingdirectory=$(pwd);

if [ "${SIPstatus}" = ' enabled' ]
then
	'Error: System Integrity Protection enabled.\nOn OS X 10.11 El Capitan and later, TotalTerminal needs a system tweak. To disable the SIP for TotalTerminal, restart to the Recovery OS partition by pressing Power then holding Command-R, launch Terminal, and enter `csrutil enable --without debug`. See https://totalterminal.binaryage.com/#sip for more information.\n'
	exit 1
fi
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

mkdir -p /Users/${USER}/Temporary/Folder${n}
cd /Users/${USER}/Temporary/Folder${n}
if [ -f /Users/${USER}/Downloads/Miscellaneous/TotalTerminal-${softwarelatestversion}.dmg ]
then
	ln -s /Users/${USER}/Downloads/Miscellaneous/TotalTerminal-${softwarelatestversion}.dmg ./
else
	curl --remote-name --remote-header-name --location https://downloads.binaryage.com/TotalTerminal-${softwarelatestversion}.dmg
fi
hdiutil mount -nobrowse -quiet TotalTerminal-${softwarelatestversion}.dmg
sudo installer -pkg /Volumes/TotalTerminal/TotalTerminal-${softwarelatestversion}.${filenameextension} -target /
hdiutil unmount -quiet /Volumes/TotalTerminal
if [ -f /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg -a -L /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg ] # 'cause what if someone does: mv TotalTerminal-1.0.dmg ../; unzip -d malware.zip malware; chmod 755 malware; ln -s malware TotalTerminal-1.0.dmg? ;)
then
	rm TotalTerminal-${softwarelatestversion}.dmg
elif [ -f /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg ]
	mv TotalTerminal-${softwarelatestversion}.dmg /Users/${USER}/Downloads/
fi
cd ${workingdirectory}
rm -d /Users/${USER}/Temporary/Folder${n}

# InstallTotalTerminal.sh
# Install TotalTerminal latest compatible version
# Cf https://totalterminal.binaryage.com/#compatibility, https://totalterminal.binaryage.com/#sip
#
# Karl 'Kabe' Bertin `kvpb`
# Telephone: +33 A BB BB BB BB
# Email: local-part@domain
# LinkedIn: https://www.linkedin.com/in/karlbertin
# Facebook: https://www.facebook.com/profile.php?id=
# Instagram: https://www.instagram.com/karlbertin/
# Snapchat: https://www.snapchat.com/add/karlbertin
<commit_msg>[.files/lib/scpt/] InstallTotalTerminal.sh updated.<commit_after>#!/usr/bin/env bash

firmwareversion=$(defaults read loginwindow SystemVersionStampAsString | cut -d. -f2- | cut -f1,1 -d'.';);
[ ${firmwareversion} -ge 11 ] && SIPstatus=$(csrutil status | sed -E 's/.*(...abled).*/\1/g';);
filenameextension='pkg';
[ ${firmwareversion} -eq 5 ] && softwarelatestversion='1.1' && filenameextension="${filenameextension/#/m}";
[ ${firmwareversion} -eq 6 ] && softwarelatestversion='1.3';
[ ${firmwareversion} -eq 7 ] && softwarelatestversion='1.4.11';
[ ${firmwareversion} -eq 8 ] && softwarelatestversion='1.5.4';
[ ${firmwareversion} -ge 9 -a ${firmwareversion} -le 12 ] && softwarelatestversion='1.6';
n=$[RANDOM%99+1] && while [ -e /Users/${USER}/Temporary/Folder${n} ]; do n=$[RANDOM%99+1]; done; # so there's no risk that the temporary directory exists and has contents, thus it spares from theneed to check this.
workingdirectory=$(pwd);

if [ "${SIPstatus}" = ' enabled' ]
then
	'Error: System Integrity Protection enabled.\nOn OS X 10.11 El Capitan and later, TotalTerminal needs a system tweak. To partially disable the SIP for TotalTerminal, restart to the Recovery OS partition by pressing Power then holding Command-R, launch Terminal, enter `csrutil enable --without debug`, and restart again. See https://totalterminal.binaryage.com/#sip for more information.\n'
	exit 1
fi
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

mkdir -p /Users/${USER}/Temporary/Folder${n}
cd /Users/${USER}/Temporary/Folder${n}
if [ -f /Users/${USER}/Downloads/Miscellaneous/TotalTerminal-${softwarelatestversion}.dmg ]
then
	ln -s /Users/${USER}/Downloads/Miscellaneous/TotalTerminal-${softwarelatestversion}.dmg ./
else
	curl --remote-name --remote-header-name --location https://downloads.binaryage.com/TotalTerminal-${softwarelatestversion}.dmg
fi
hdiutil mount -nobrowse -quiet TotalTerminal-${softwarelatestversion}.dmg
sudo installer -pkg /Volumes/TotalTerminal/TotalTerminal-${softwarelatestversion}.${filenameextension} -target /
hdiutil unmount -quiet /Volumes/TotalTerminal
if [ -f /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg -a -L /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg ] # 'cause what if someone does: mv TotalTerminal-1.0.dmg ../; unzip -d malware.zip malware; chmod 755 malware; ln -s malware TotalTerminal-1.0.dmg? ;)
then
	rm TotalTerminal-${softwarelatestversion}.dmg
elif [ -f /Users/${USER}/Temporary/Folder${n}/TotalTerminal-${softwarelatestversion}.dmg ]
	mv TotalTerminal-${softwarelatestversion}.dmg /Users/${USER}/Downloads/
fi
cd ${workingdirectory}
rm -d /Users/${USER}/Temporary/Folder${n}

# InstallTotalTerminal.sh
# Install TotalTerminal latest compatible version
# Cf https://totalterminal.binaryage.com/#compatibility, https://totalterminal.binaryage.com/#sip
#
# Karl 'Kabe' Bertin `kvpb`
# Telephone: +33 A BB BB BB BB
# Email: local-part@domain
# LinkedIn: https://www.linkedin.com/in/karlbertin
# Facebook: https://www.facebook.com/profile.php?id=
# Instagram: https://www.instagram.com/karlbertin/
# Snapchat: https://www.snapchat.com/add/karlbertin

{'fraction_non_alphanumeric': 0.1629231255931667, 'fraction_numerical': 0.015817779183802595, 'mean_word_length': 5.033396946564886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 16, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4916592', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2038, 'n_words': 497}