Skip to content

Commit 170b877

Browse files
committed
some linux assets installed using installer shell script
1 parent e3a96e7 commit 170b877

7 files changed

+164
-0
lines changed

assets/linux/biglybt-lightgray.svg

+16
Loading

assets/linux/biglybt.desktop

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env xdg-open
2+
[Desktop Entry]
3+
Name=BiglyBT
4+
GenericName=BitTorrent Client
5+
Exec=${installer:dir.main}/biglybt %U
6+
Icon=${installer:dir.main}/biglybt.svg
7+
Terminal=false
8+
Type=Application
9+
MimeType=x-scheme-handler/magnet;application/x-bittorrent;application/x-biglybt;x-scheme-handler/biglybt;
10+
Categories=Application;Network;FileTransfer;P2P;GTK;Java;
11+
StartupWMClass=BiglyBT

assets/linux/biglybt.png

10.1 KB
Loading

assets/linux/biglybt.svg

+27
Loading

assets/linux/registerBiglyBT

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# This file installs the .desktop file into your Desktop Environment
3+
# Should be able to run as user as sudo (sudo will install it globally)
4+
5+
if [ -x "$(command -v desktop-file-install)" ]; then
6+
desktop-file-install biglybt.desktop
7+
fi
8+
if [ -x "$(command -v xdg-desktop-menu)" ]; then
9+
xdg-desktop-menu install --novendor biglybt.desktop
10+
fi
11+
12+
exit 0

assets/linux/unregisterBiglyBT

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# This file removed the .desktop file registration from your Desktop Environment
3+
4+
if [ -x "$(command -v xdg-desktop-menu)" ]; then
5+
xdg-desktop-menu uninstall --novendor biglybt.desktop
6+
fi
7+
8+
if [ -f /usr/share/applications/biglybt.desktop ]; then
9+
# probably won't work unless sudo
10+
rm "/usr/share/applications/biglybt.desktop"
11+
fi
12+
13+
exit 0

assets/linux/updateBiglyBT

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
# Runs the Updater.jar plugin and processes any pending updates
3+
set -x
4+
# First Run:
5+
# updateBiglyBT [-Dproperty=val ...] -Dazureus.script.version="X" <mainClass> <"updateonly"|"restart"> <appPath> <userPath> <configOverride>
6+
# Second Run if sudo was needed:
7+
# updateBiglyBT "rerun" <originalUser> $@
8+
9+
exists () {
10+
type "$1" >/dev/null 2>/dev/null
11+
}
12+
13+
if [ "$1" = "rerun" ]; then
14+
ISRERUN=1
15+
else
16+
ISRERUN=0
17+
fi
18+
19+
if [ $ISRERUN -eq 1 ]; then
20+
PARAMS=( "${@:3}" )
21+
else
22+
SCRIPT=`realpath $0`
23+
SCRIPTPATH=`dirname $SCRIPT`
24+
25+
if [ "$1" = "" ]; then
26+
# No params were passed in, make ones up
27+
PARAMS=( "com.biglybt.update.Updater" "updateonly" "${SCRIPTPATH}" "${HOME}/.biglybt" )
28+
else
29+
PARAMS=( "${@}" )
30+
fi
31+
32+
for i in "${!PARAMS[@]}"; do
33+
if [ "${PARAMS[$i]}" = "updateonly" ] || [ "${PARAMS[$i]}" = "restart" ]; then
34+
PARAM_IDX_APPPATH=$(( $i + 1 ))
35+
break
36+
fi
37+
done
38+
39+
if [ ! -w "${PARAMS[${PARAM_IDX_APPPATH}]}" ]; then
40+
# Can't write to appdir, going to need super user
41+
42+
if [ "$EUID" -ne 0 ]; then
43+
if exists "pkexec"; then
44+
CMD="pkexec"
45+
elif exists "gksudo"; then
46+
CMD="gksudo"
47+
elif exists "kdesudo"; then
48+
CMD="kdesudo"
49+
elif exists "sudo"; then
50+
CMD="sudo"
51+
else
52+
echo "Can't get write access to ${PARAMS[${PARAM_IDX_APPPATH}]}"
53+
echo "Please run ${SCRIPT} with higher access level"
54+
exit 1
55+
fi
56+
57+
echo Running as root..
58+
$CMD $SCRIPT "rerun" "${USER}" ${PARAMS[@]}
59+
if [ $? -ne 0 ]; then
60+
echo "Could not run with ${CMD}. Trying one more time with sudo"
61+
sudo $SCRIPT "rerun" "${USER}" ${PARAMS[@]}
62+
fi
63+
exit
64+
fi
65+
66+
fi
67+
68+
fi
69+
70+
for i in "${!PARAMS[@]}"; do
71+
if [ "${PARAMS[$i]}" = "updateonly" ] || [ "${PARAMS[$i]}" = "restart" ]; then
72+
PARAM_IDX_USERPATH=$(( $i + 2 ))
73+
break
74+
fi
75+
done
76+
77+
echo Running Updater..
78+
java -cp "${PARAMS[${PARAM_IDX_USERPATH}]}/plugins/azupdater/Updater.jar" ${PARAMS[@]}
79+
80+
if [ $ISRERUN -eq 1 ]; then
81+
echo Ensuring $2 still owns ${PARAMS[${PARAM_IDX_USERPATH}]}
82+
chown -R $2:$2 ${PARAMS[${PARAM_IDX_USERPATH}]}
83+
fi
84+
85+
echo Done

0 commit comments

Comments
 (0)