forked from Novator/Pandora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpandora.sh
executable file
·103 lines (98 loc) · 3.25 KB
/
pandora.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
#!/bin/sh
#This is a script for running Pandora, installing Ruby, and setting environment on Linux
#(c) Michael Galyuk, Pandora, free software
# Advice: uncomment a line if Pandora cannot define your language correctly
#export LANG="de_DE.UTF-8"
#export LANG="es_ES.UTF-8"
#export LANG="fr_FR.UTF-8"
#export LANG="it_IT.UTF-8"
#export LANG="pl_PL.UTF-8"
#export LANG="ru_RU.UTF-8"
#export LANG="tr_TR.UTF-8"
#export LANG="en_US.UTF-8"
#export LANG="en_AU.UTF-8"
#export LANG="ua_UA.UTF-8"
DIRFILE=`readlink -e "$0"`
CURFILE=`basename "$DIRFILE"`
CURDIR=`dirname "$DIRFILE"`
# Searching a path to ruby
PARAMS="$1"
RUBY=`which ruby2.0`
if [ "$RUBY" = "" ]; then
RUBY=`which ruby1.9.3`
if [ "$RUBY" = "" ]; then
RUBY=`which ruby1.9.1`
if [ "$RUBY" = "" ]; then
RUBY=`which ruby`
fi
fi
fi
if [ "$RUBY" = "" ]; then
if [ ! -f "$RUBY" ]; then
RUBY="/usr/bin/ruby"
if [ ! -f "$RUBY" ]; then
RUBY="/usr/local/bin/ruby"
if [ ! -f "$RUBY" ]; then
echo "Ruby is not found. Trying to install by \"$CURFILE init\""
RUBY="ruby"
PARAMS="init"
fi
fi
fi
fi
# Make an action according to command line arguments
case "$PARAMS" in
help|h|--help|?|/?)
echo "Script Pandora params:"
echo " $CURFILE --help - show this help"
echo " $CURFILE --init - install necessary packets with apt-get (recommended)"
echo " $CURFILE --gem-init - install minimum packets, install ruby packet with rubygem"
echo " $CURFILE [params] - run Pandora with original params"
if [ -f "$RUBY" ]; then
$RUBY ./pandora.rb --shell
fi
;;
init|install|--init|--install|-i)
echo "Installing Ruby and necessary packages with apt-get.."
sudo apt-get -y install ruby ruby-sqlite3 ruby-gtk2 ruby-gstreamer \
gstreamer0.10-ffmpeg gstreamer0.10-x openssl libopenssl-ruby
;;
full|full-init|--full|--full-init|-fi)
PANDORA_DIR="/opt/pandora"
# 1. Make Pandora application directory
sudo mkdir $PANDORA_DIR
# 2. Give rights to Pandora to all users
sudo chmod -R a+rw $PANDORA_DIR
# 3. Go to Pandora directory
cd $PANDORA_DIR
# 4. Download archive with last Pandora version
wget -t 0 -c -T 15 --retry-connrefused=on https://github.com/Novator/Pandora/archive/master.zip
# 5. Extract archive [to subdirectory "Pandora-master"]
unzip -o ./master.zip
# 6. Move files to application directory
mv -f ./Pandora-master/* ./
# 7. Delete empty "Pandora-master"
rm -R ./Pandora-master
# 8. Delete unnecessary archive
rm ./master.zip
# 9. Make main script executable
chmod a+x ./pandora.sh
# 10. Copy shortcut to Menu
sudo cp -f ./view/pandora.desktop /usr/share/applications/
# 11. Install additional packets (ruby, openssl, sqlite, gstreamer)
./pandora.sh --init
# 12. Give rights to all users again
sudo chmod -R a+rw $PANDORA_DIR
# 13. Run Pandora
$RUBY ./pandora.rb $@
;;
gem-init|gem-install|--gem-init|--gem-install|-gi|--gem|gem)
echo "Installing Ruby and necessary packages with apt-get and rubygem.."
sudo apt-get -y install ruby gstreamer0.10-ffmpeg gstreamer0.10-x openssl rubygems
sudo gem install sqlite3 gtk2 gstreamer openssl
;;
*)
cd "$CURDIR"
$RUBY ./pandora.rb $@
;;
esac