-
Notifications
You must be signed in to change notification settings - Fork 4
/
playonlinux-cmd
executable file
·151 lines (142 loc) · 4.15 KB
/
playonlinux-cmd
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
#!/bin/bash
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2007 Pâris Quentin
# Copyright (C) 2010 PETIT Aymeric
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#Variables
die() ## PHP function copy
{
echo "$@"
exit
}
[ "$PLAYONLINUX" = "" ] || die "You are already in a PlayOnLinux environement"
#si root -> exit
[ `id -u` -eq 0 ] && die "This software can't be used as root"
#Dans quel répértoire se trouve le script ?
PLAYONLINUX=`dirname "$0"`
cd "$PLAYONLINUX"
export PLAYONLINUX=`pwd`
#used for switch from gui to a text system.
#allow installing software w/o X server.
export POL_CMD=true
source "$PLAYONLINUX/lib/sources"
if [ "$1" = "--version" ]
then
echo "PlayOnLinux Command Line $VERSION"
exit 0
fi
echo "PlayOnLinux Command Line v$VERSION"
echo ""
if [ ! "$(which $PYTHON)" ]
then
missing "$PYTHON"
fi
function usage
{
echo "$(eval_gettext 'This program is intended to be used by automatic scripts to manage PlayOnLinux.')"
echo "Usage: $0"
echo -e "\t[--version] $(eval_gettext ' print current version and exit.')"
echo -e "\t[--update] $(eval_gettext ' update the PlayOnLinux script repository.')"
echo -e "\t[--run 'Software name'] $(eval_gettext ' run an existing application.')"
echo -e "\t[--start-install 'Script Name']$(eval_gettext ' start installing the specified script.')"
echo -e "\t[--search 'Script Name'] $(eval_gettext ' perform search into the script repository.')"
echo -e "\t[--list] $(eval_gettext ' list software installed with PlayOnLinux.')"
echo -e "\t[--remove 'Script Name'] $(eval_gettext ' remove an existing application.')"
exit 1
}
#parsing switch
case $1 in
-u|--update)
#build personnal repository
construire_repertoire_personnel
if [ -z "$2" ]
then
#update list of script
if [ -d "$HOME/.PlayOnLinux/configurations/listes" ]
then
bash "$PLAYONLINUX/bash/check_maj_"
echo $?
exit
fi
maj_check
elif [ "$2" == "--force" ]
then
maj_check
fi
;;
--run)
#pour ne pas reinventer la roue ...
if [ -z "$2" ] ; then usage ; fi
#already done in start_pol
start_pol "@"
;;
-si|--start-install)
#deja
if [ -z "$2" ] ; then usage ; fi
construire_repertoire_personnel
#fun function!
if [ "${2:0:1}" == "/" ]
then
#local script
if [ -e "$2" ]
then
#il existe donc on lance
bash "$2"
exit
fi
#si on est ici c'est que c'était pas bon donc on teste une nouvelle methode
fi
#script install
if [ "$2" == "install" ]
then
if [ -e "$REPERTOIRE/install" ]
then
bash $REPERTOIRE/install
fi
exit
fi
#voila voila ...
name=${2//" "/"%20"}
rm -f $REPERTOIRE/install 2>/dev/null
wget -q "$SITE/V3_data/repository/get_file.php?version=playonlinux-$VERSION&id=$name" -O $REPERTOIRE/install || die "$(eval_gettext 'Please make sure you are connected to the Internet.')"
if [ -e "$REPERTOIRE/install" ]
then
bash $REPERTOIRE/install
fi
;;
--search)
if [ -z "$2" ] ; then usage ; fi
#build personnal repository
construire_repertoire_personnel
echo -e "$(eval_gettext "The search needs an updated repository.\nIf the results seem outdated, please run an update.")"
echo "$(eval_gettext "Search result(s): ")"
grep -i -- "$2" $REPERTOIRE/configurations/listes/search
;;
-ls|--list)
#build personnal repository
construire_repertoire_personnel
echo "$(eval_gettext "Currently installed applications:")"
ls -1 $REPERTOIRE/configurations/installed/
;;
-rm|--remove)
if [ -z "$2" ] ; then usage ; fi
#build personnal repository
construire_repertoire_personnel
$PLAYONLINUX/bash/uninstall "$2"
;;
*)
usage
;;
esac
echo ""
exit 0