-
Notifications
You must be signed in to change notification settings - Fork 2
/
discord.doriah
144 lines (108 loc) · 4.16 KB
/
discord.doriah
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
!![script]!!
!!![basic_info]!!!
title: Install Discord
script_description: This one installs Discord, and does it beautifully!
+++[basic_info]+++
!!![whole_script]!!!
#!/usr/bin/env bash
literal_name_of_installation_directory="###installation_directory###"
general_installation_directory="$HOME/$literal_name_of_installation_directory"
local_bin_path="$HOME/.local/bin"
local_application_path="$HOME/.local/share/applications"
tar_location=$(mktemp /tmp/discord.XXXXXX.tar.gz)
version_name_with_slash=###version_name_with_slash###
app_name=###app_name###
executable_name=###executable_name###
echo ###version_specific_greet###
app_installation_directory="$general_installation_directory/$app_name"
app_bin_in_local_bin="$local_bin_path/$app_name"
desktop_in_local_applications="$local_application_path/$app_name.desktop"
icon_path=$app_installation_directory/discord.png
executable_path=$app_installation_directory/$executable_name
link="https://discord.com/api$version_name_with_slash/download?platform=linux&format=tar.gz"
file=discord-$version.tar.gz
dir=Discord
echo "Installing Discord..."
echo "Installation target=$app_installation_directory"
sleep 1
# Delete from opt and usr if Discord is already installed
if [ -f $app_bin_in_local_bin ]; then
echo "Old bin file detected, removing..."
rm $app_bin_in_local_bin
fi
if [ -d $app_installation_directory ]; then
echo "Old app files are found, removing..."
rm -rf $app_installation_directory
fi
if [ -f $desktop_in_local_applications ]; then
echo "Old bin file detected, removing..."
rm $desktop_in_local_applications
fi
if [ ! -d $general_installation_directory ]; then
echo "Creating the $general_installation_directory directory for installation"
mkdir $general_installation_directory
fi
if [ ! -d $local_bin_path ]; then
echo "$local_bin_path not found, creating it for you"
mkdir $local_bin_path
fi
if [ ! -d $local_application_path ]; then
echo "$local_application_path not found, creating it for you"
mkdir $local_application_path
fi
# Download Discord
echo "Downloading Discord..."
curl -L $link -o $tar_location
if [ $? -eq 0 ]; then
echo OK
else
echo "Installation failed. Curl not found or not installed"
exit
fi
# Extract Discord
echo "Extraction in process.."
mkdir $app_name
tar -xvf $tar_location -C $app_name --strip-components=1
current_desktop_path="$app_name/$app_name.desktop"
# Change the code of the desktop so it will see the icon
echo "Adjusting desktop file to tailor your needs..."
sed -i "s|Icon=$app_name|Icon=$icon_path|g" $current_desktop_path
sed -i "s|Exec=/usr/share/$app_name/$executable_name|Exec=$executable_path|g" $current_desktop_path
# Install Discord
echo "Moving files to your safe directory..."
mv $app_name $app_installation_directory
# Create desktop entry
echo "Copying a personalized desktop entry..."
cp $app_installation_directory/$app_name.desktop $desktop_in_local_applications
# Create symbolic link
echo "Creating a bin file for the current user..."
touch $app_bin_in_local_bin
chmod u+x $app_bin_in_local_bin
echo "#!/bin/bash
$executable_path" >> $app_bin_in_local_bin
# Cleanup
echo "Cleaning up..."
rm $tar_location
rm -rf $dir
echo "Installation is successful!"
echo "Discord is now installed on your system, if it does not show up on the menu, restart your DE or log out and log back in."
sleep 3
echo "Have fun!"
sleep 2
exit 0
+++[whole_script]+++
!!![loadouts]!!!
!!!![loadout]!!!!
title: Default
variables: installation_directory => .tarball-installations,,,version_name_with_slash => "",,,app_name => discord,,,executable_name => Discord,,,version_specific_greet => Vanilla, nice choice!,,,
++++[loadout]++++
!!!![loadout]!!!!
title: Canary
variables: installation_directory => .tarball-installations,,,version_name_with_slash => "/canary",,,app_name => discord-canary,,,executable_name => DiscordCanary,,,version_specific_greet => Canary, fancy!,,,
++++[loadout]++++
!!!![loadout]!!!!
title: PTB
variables: installation_directory => .tarball-installations,,,version_name_with_slash => "/ptb",,,app_name => discord-ptb,,,executable_name => DiscordPTB,,,version_specific_greet => PTB, welcome to the testing realm!,,,
++++[loadout]++++
+++[loadouts]+++
++[script]++