-
Notifications
You must be signed in to change notification settings - Fork 2
/
archbox_2xbmc.sh
168 lines (151 loc) · 6.89 KB
/
archbox_2xbmc.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
################################################################################################################
#------------------------------------------------------------------------------------------------------
# ARCHBOX_2XBMC.SH --> DEBUT
#------------------------------------------------------------------------------------------------------
archi=`uname -m`
rep=`(cd $(dirname "$0"); pwd)` 2>/dev/null
export LANG="fr_FR.UTF-8"
export keymap="fr-pc"
export blue="\\033[1;34m"
export cyan="\\033[1;36m"
export green="\\033[1;32m"
export nc="\\033[0;39m"
export red="\\033[1;31m"
export white="\\033[1;37m"
export yellow="\\033[1;33m"
export ok="[ $yellow OK $white ]$green"
echo " "
echo " "
echo -e "$green ******************************************************************************"
echo -e "$green * "
echo -e "$green * [$red ARCHBOX $green ]"
echo -e "$green * Votre console multimedia de salon"
echo -e "$green * Installation $yellow [XBMC]$cyan [En cour...]"
echo -e "$green * "
echo -e "$green ******************************************************************************"
echo " "
################################################################################################################
################################################################################################################
#------------------------------------------------------------------------------------------------------
# Vérification fichier lck
#------------------------------------------------------------------------------------------------------
sh $rep/tools/archbox-opt/archbox_error.sh "lck" "$rep/2xbmc.lck"
if [ -f "$rep/2xbmc.lck" ] ; then
rm $rep/2xbmc.lck
fi
#------------------------------------------------------------------------------------------------------
# Nouveau utilisateur
#------------------------------------------------------------------------------------------------------
if [ -z "$1" ] ; then
read -p "Nouveau utilisateur : (défaut xbmc) " user
if [ -z "$user" ] ; then
user="xbmc"
fi
else
user="$1"
fi
export HOME="/home/$user"
#------------------------------------------------------------------------------------------------------
# Architecture (i386 - i686 - x86_64 - armv6l)
#------------------------------------------------------------------------------------------------------
echo -e "Votre architecture : $cyan$archi"
echo -e "$red"
if [ "$archi" = "armv6l" ] ; then
read -p "Votre machine est elle un Raspberry Pi Oui ? Non ? [def:Non] : " rpi
case $rpi in
"o"|"oui"|"O"|"Oui"|"OUI"|"y"|"yes"|"Y"|"Yes"|"YES")
archi="rpi" ;;
*)
echo " " ;;
esac
fi
#------------------------------------------------------------------------------------------------------
# Mise à jour + Installation
#------------------------------------------------------------------------------------------------------
sh $rep/tools/archbox-opt/archbox_maj.sh
################################################################################################################
################################################################################################################
echo -e "$green ******************************************************************************"
echo -e "$green * Installation XBMC"
echo -e "$green ******************************************************************************"
echo -e "$red * Information : XBMC classique ou PVR(avec tuner tv) ?"
LISTE=(" * Xbmc Classique" " Kodi " " * Xbmc PVR")
select CHOIX in "${LISTE[@]}" ; do
case $REPLY in
1)
echo -e "$white$ok Installation XBMC sans PVR $cyan"
pacman -S --noconfirm xbmc
echo -e "$white$ok Installation XBMC "
break
;;
2)
echo -e "$white$ok Installation XBMC sans PVR $cyan"
yaourt -S --noconfirm kodi-devel
echo -e "$white$ok Installation XBMC "
break
;;
3)
echo -e "$white$ok Installation :" "$nc" " XBMC PVR $cyan"
yaourt -S --noconfirm xbmc-eden-pvr-git tvheadend-git linuxtv-dvb-apps w_scan
systemctl enable tvheadend.service
echo -e "$white$ok Installation XBMC "
break
;;
esac
done
################################################################################################################
################################################################################################################
#------------------------------------------------------------------------------------------------------
# RPI
#------------------------------------------------------------------------------------------------------
if [[ ! $archi = "rpi" ]] ; then
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
echo -e "$ok $green Config /etc/sudoers"
fi
#------------------------------------------------------------------------------------------------------
# Creation repertoire sur /home/$user/
#------------------------------------------------------------------------------------------------------
mkdir $HOME/Bureau $HOME/Musique $HOME/Videos $HOME/Image
echo -e "$white$ok Création des repertoires sur $HOME"
#------------------------------------------------------------------------------------------------------
# Gestion irc + télécommande
#------------------------------------------------------------------------------------------------------
pacman -S --noconfirm lirc lirc-utils
if [ -f "/etc/polkit-1/rules.d/10-xbmc.rules" ] ; then
rm /etc/polkit-1/rules.d/10-xbmc.rules
fi
cat <<EOF >/etc/polkit-1/rules.d/10-xbmc.rules
polkit.addRule(function(action, subject) {
if(action.id.match("org.freedesktop.login1.") && subject.isInGroup("power")) {
return polkit.Result.YES;
}
});
EOF
echo -e "$white$ok Ajout du éteindre, restart, veille, pause + télécommande"
#------------------------------------------------------------------------------------------------------
# Gestion des polices
#------------------------------------------------------------------------------------------------------
cat <<EOF >/var/lib/polkit-1/localauthority/50-local.d/xbmc.pkla
[Actions \for $user user]
Identity=unix-user:$user
Action=org.freedesktop.devicekit.power.*;org.freedesktop.consolekit.system.*
ResultActive=yes
ResultAny=yes
ResultInactive=no
EOF
echo -e "$white$ok Controle d\'extinction "
cat <<EOF > $rep/2xbmc.lck
#----------------------------
# ARCHBOX_2XBMC.SH --> [OK]
#----------------------------
EOF
################################################################################################################
################################################################################################################
echo -e "$green ******************************************************************************"
echo -e "$green * "
echo -e "$green * [$red ARCHBOX$green ]"
echo -e "$green * Installation $yellow [XBMC]$red Terminé"
echo -e "$green * "
echo -e "$green ****************************************************************************** $nc"
################################################################################################################