-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bash
More file actions
38 lines (26 loc) · 1003 Bytes
/
install.bash
File metadata and controls
38 lines (26 loc) · 1003 Bytes
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
#!/bin/bash
directoryToInstall=$HOME/.wpm
pathToDownload=$directoryToInstall/source.zip
echo "Downloading Wind Pacakge Manager from GitHub..."
mkdir "$HOME"/.wpm
latest_release=$(curl -s "https://api.github.com/repos/WindEntertainment/wpm/releases/latest")
download_url=$(echo "$latest_release" | grep '"browser_download_url":' | sed 's/.*"browser_download_url": "\(.*\)".*/\1/')
filename=$(basename "$download_url")
echo "Downloading $filename from $download_url..."
curl -L -o "$pathToDownload" "$download_url"
if [ $? -ne 0 ]; then
echo "An unexpected error occurred while downloading"
exit 1
fi
echo "Download complete: $filename"
echo "Extracting files..."
unzip -o "${pathToDownload}" -d "${HOME}/.wpm/"
if [ $? -ne 0 ]; then
echo "Failed to extract $pathToDownload"
exit 1
fi
echo "Extraction complete. Files are available in $directoryToInstall"
echo "Installing..."
chmod +x "${HOME}/.wpm/wpm"
sudo mv "${HOME}/.wpm/wpm" "/usr/local/bin"
echo "Installed to /usr/local/bin"