-
Notifications
You must be signed in to change notification settings - Fork 61
/
upload.sh
executable file
·56 lines (54 loc) · 1.17 KB
/
upload.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
#!/bin/bash
declare -A manager;
manager[/etc/redhat-release]=yum;
manager[/etc/arch-release]=pacman;
manager[/etc/gentoo-release]=emerge;
manager[/etc/debian_version]=apt-get;
if ! [ -x "$(command -v twine)" ]; then
if [ "$UID" -eq 0 ]; then
echo "Press enter to install twine";
choice="y";
else
echo "You do not have twine installed, do you want to restart with root permission and install it? (Y/N): ";
read -r TMP;
if [ $TMP == "y" ] || [ $TMP == "Y" ]; then
exec sudo "$0" "$@"
else
echo "Quitting"
exit
fi
fi
if [ $choice == "y" ]; then
for f in ${!manager[@]}
do
if [[ -f $f ]];then
manager=${manager[$f]}
echo "Detected $manager as your package manager";
case $manager in
pacman)
pacman -S twine
;;
apt-get)
apt install twine
;;
emerge)
emerge twine
;;
yum)
yum install twine
esac
echo "\"twine\" should be installed now."
rm dist/*
python3 setup.py sdist bdist_wheel
twine upload dist/*
fi
done
else
echo "Quitting.."
exit 1;
fi
else
rm dist/*
python3 setup.py sdist bdist_wheel
twine upload dist/*
fi