-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwine.sh
85 lines (77 loc) · 2.58 KB
/
wine.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
#!/bin/bash
#------------------------------------------------------------------------------#
# For Linux Environments, You Need To Run This In Wine Inside The Source Folder #
#------------------------------------------------------------------------------#
# Errors & Fixes Sources Strings!!
Wine_Error="Error: Wine is not Installed!!"
Python_Error="Error: Python is not Installed in Wine!!"
Wine_Fix="You Can Refer To This Documentation For Assistance:"
Wine_Fix_Web="https://www.winehq.org/pipermail/wine-devel/2002-January/003468.html"
Pip_Check="Checking Dependencies [It will install them with PIP if not found]"
Pip_Error="Please Connect To The Internet To Install The Dependencies"
depend=("wine" "python" "numpy" "pillow")
# Checks If Wine & Python Is Installed
function check_depend {
for package in {0..1}; do
if ${depend[$package]} --version ; then
clear ; echo "Checking ${depend[$package]}..." ; sleep 2
clear ; echo "'${depend[$package]}' is Installed!!" ; sleep 2
else
if ["$package" == "2"]; then
clear ; echo $Python_Error
else
clear ; echo $Wine_Error ; echo $Wine_Fix ; echo $Wine_Fix_Web
fi
fi
done
}
# Checks & Installs The Python Dependencies
function check_py_depend {
clear ; echo $Pip_Check ; sleep 1
for package in {2..3}; do
clear ; echo "Checking '${depend[$package]}'..." ; sleep 2
if wine pip install ${depend[$package]} ; then
clear ; echo "'${depend[$package]}' is Installed" ; sleep 2 ; clear
else
clear ; echo $Pip_Error
fi
done
}
# Running The Program In Wine & Handles Errors!!
function program {
if wine python $(pwd)/window.py; then
clear ; echo "Program Exited!!"
if pkill wine-run; then
continue
else
pkill sh
fi
else
clear ; echo "Program Exited Due Too.."
echo "Error: Your Running The Program Inside The Wine Directory"
echo "Fix: Please Consider Running It In The Os Directory"
echo " (cd source folder then sh wine-run.sh)"
fi
}
function progress {
while :; do
progress_text=("." ".." "..." " ")
for loading in {0..2}; do
clear ; echo "Running Program${progress_text[$loading]}" ; sleep 1
done
done
}
# Options to Choose When running the Program
case ${1,,} in
--ignore-depend)
program "Program Is Running!!" & progress
;;
--help)
clear
echo " MC-Sky-Builder:"
echo " // by default (the program first takes time to verify the dependencies)"
echo " --ignore-depend (to skip this process)"
;;
*)
check_depend ; check_py_depend ; program & progress
esac