mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Download and install packages for Ubuntu and OS X
This both downloads the v0.3.0 release for the current platform and now also installs it (requiring `sudo`). Should probably rename.
This commit is contained in:
1 parent
3d56952369
commit
a5dfe80d9a
1 file changed
+29
-3
+29
-3
@@ -2,13 +2,39 @@
|
||||
|
||||
[[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; }
|
||||
|
||||
# Set OS specific asset ID and package name
|
||||
case "$OSTYPE" in
|
||||
linux*)
|
||||
asset='1536045'
|
||||
package='powershell_0.3.0-1_amd64.deb'
|
||||
;;
|
||||
darwin*)
|
||||
asset='1536063'
|
||||
package='powershell-0.3.0.pkg'
|
||||
;;
|
||||
*)
|
||||
exit 2 >&2 "$OSTYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Authorizes with read-only access to GitHub API
|
||||
# Retrieves URL of v0.3.0 release asset
|
||||
# Downloads asset to powershell.deb
|
||||
curl -s -i \
|
||||
-H "Authorization: token $GITHUB_TOKEN " \
|
||||
-H 'Accept: application/octet-stream' \
|
||||
'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1536045' |
|
||||
"https://api.github.com/repos/PowerShell/PowerShell/releases/assets/$asset" |
|
||||
grep location |
|
||||
sed 's/location: //g' |
|
||||
wget -i - -O powershell.deb
|
||||
wget -i - -O $package
|
||||
|
||||
# Installs PowerShell package
|
||||
case "$OSTYPE" in
|
||||
linux*)
|
||||
sudo dpkg -i ./$package
|
||||
;;
|
||||
darwin*)
|
||||
sudo installer -pkg ./$package -target /
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Congratulations! PowerShell is now installed."
|
||||
Reference in new issue
Block a user