-
Notifications
You must be signed in to change notification settings - Fork 0
/
winey
executable file
·126 lines (108 loc) · 2.62 KB
/
winey
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
#!/bin/bash
# Script for the installation and management of Wine profiles.
# Copyright (C) 2013-2015 Scott Weldon
# 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 3 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, see <http://www.gnu.org/licenses/>.
configfolder="$HOME/.scott_script/wine"
filename="config"
configfile="$configfolder/$filename"
year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
hour=$(date +%H)
min=$(date +%M)
validArgs=("logloc" "winenames" "winelocs" "prefix" "progbin")
function usage() {
echo "Usage: wine <command>"
echo
echo "Commands:"
echo " <program>"
echo " init"
echo " config"
echo " debug"
echo
exit 1
}
function checkpath() {
if [ ! -d "$1" ]
then
mkdir --parents $1
fi
}
function loadconf() {
if [ -e $configfile ]
then
echo "Loading config file."
source loadconf "$configfolder" "$filename" validArgs[@]
else
echo "No config file found, creating one."
checkpath $configfolder
edit
saveconf
fi
}
function edit() {
source editconf "wine.xml" "$1"
saveconf
}
function saveconf() {
source saveconf "Wine" "$configfolder" "$filename" validArgs[@]
return $?
#echo "declare -A programs" >> $configfile
#for prog in "${programs[@]}"
}
function printconf() {
echo "Contents of config file, stored at $configfile :"
cat $configfile
echo
}
function run() {
progname=$1
logfolder=$logloc/$progname
checkpath $logfolder
logfile=$logfolder/$year.$month.$day-$hour.$min.txt
echo >> $logfile
echo \# $(date +%B%e), $(date +%_Y), $(date +%_T) >> $logfile
if [ "$1" == "program" ]
then
#cd $progbin
WINEPREFIX=$prefix $wineloc/wine $2 >> $logfile 2>&1
elif [ "$1" == "edit" ]
then
WINEPREFIX=$prefix $wineloc/wine winecfg >> $logfile 2>&1
elif [ "$1" == "install" ]
then
WINEPREFIX=$prefix $wineloc/wine start "./$2" >> $logfile 2>&1
else
"Error, wrong option for run(). Should never reach here."
exit 3
fi
}
loadconf
case $1 in
"edit")
editconf $2
;;
"init")
run init
;;
"debug")
printconf
;;
"run")
run program $2
;;
"install")
run "install" $2
;;
*)
usage
esac