-
Notifications
You must be signed in to change notification settings - Fork 26
/
install.sh
executable file
·59 lines (52 loc) · 2.67 KB
/
install.sh
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
#!/usr/bin/env bash
# make the users aware that there are multiple layouts
echo "Trebuie sa alegi aranjamentul potrivit pentru tastatura ta."
echo
echo "Aranjamentele mapeaza tasta \"\` si ~\" in pozitia uzuala, inainte de tasta 1."
echo "Apple furnizeaza cel putin 3 aranjamente diferite din punct de vedere vizual."
echo "Acele aranjamente sunt de fapt vreo doua din punct de vedere functional."
echo
echo "» Primul aranjament are tasta inscriptionata cu \"\` si ~\" inainte de 1"
echo "» Al doilea aranjament are tasta inscriptionata cu \"§ si ±\" inainte de 1"
echo
echo "Cel de-al doilea aranjament se poate intalni si in cazul tastaturilor care"
echo "au inscriptionate diacritice pentru limba Romana fabricate de Apple, dar "
echo "nu in pozitiile definite de SR 13392:2004. Acest tip de aranjament are o "
echo "tasta suplimentara intre Shift si Z."
echo
read -p "Alege varianta aranjamentului (1 sau 2): " layout
if [ "${layout}" != "1" ] && [ "${layout}" != "2" ]
then
echo "Aranjamentul ales este invalid. Valori acceptate: 1 sau 2."
exit 1
fi
# the directory may not exist
sudo mkdir -p "/Library/Keyboard Layouts"
# removing the previous version
sudo rm -fv "/Library/Keyboard Layouts/Romanian Programmers Mac.keylayout"
sudo rm -fv "/Library/Keyboard Layouts/Romanian Programmers Mac.icns"
# install / update the current version
if [ "$1" == "local" ]
then
echo "» Instalez Romanian - Programmers folosind depozitul curent"
echo "» Instalez Romanian - Programmers.icns"
sudo cp "Romanian - Programmers.icns" "/Library/Keyboard Layouts/"
echo "» Instalez Romanian - Programmers ${layout}.keylayout"
sudo cp "Romanian - Programmers ${layout}.keylayout" \
"/Library/Keyboard Layouts/Romanian - Programmers.keylayout"
else
echo "» Instalez Romanian - Programmers folosind GitHub"
echo "» Instalez Romanian - Programmers.icns"
sudo curl --silent --location --max-redirs 10 \
"https://raw.githubusercontent.com/SaltwaterC/romanian-programmers-mac/master/Romanian%20-%20Programmers.icns" \
--output "/Library/Keyboard Layouts/Romanian - Programmers.icns"
echo "» Instalez Romanian - Programmers ${layout}.keylayout"
sudo curl --silent --location --max-redirs 10 \
"https://raw.githubusercontent.com/SaltwaterC/romanian-programmers-mac/master/Romanian%20-%20Programmers%20${layout}.keylayout" \
--output "/Library/Keyboard Layouts/Romanian - Programmers.keylayout"
fi
# clear the OS intl caches
sudo find /System/Library/Caches -name "*IntlDataCache*" 2>/dev/null | sudo xargs rm -v
sudo find /var -name "*IntlDataCache*" 2>/dev/null | sudo xargs rm -v
# in case of update ...
echo -e "\n\033[1mAtentie: pentru ca schimbarile sa fie vizibile dupa actualizare, este nevoie de logout + login\033[0m"