-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from FilenCloudDienste/dev/install-script
Install script and NPM package
- Loading branch information
Showing
11 changed files
with
184 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
# check if filen-cli is already installed | ||
if [[ ! -z $(which filen) ]] ; then | ||
echo "Filen CLI is already installed" | ||
echo "You can install a different version using \`filen install <version>\` or \`filen install latest\`" | ||
echo "To uninstall, delete ~/.filen-cli and revert changes to your shell profile(s)" | ||
else | ||
|
||
# determine platform as "linux" or "macos" | ||
if [[ "$(uname -s)" == "Linux" ]] ; then | ||
platform=linux | ||
elif [[ "$(uname -s)" == "Darwin" ]] ; then | ||
platform=macos | ||
fi | ||
|
||
# determine architecture as "x64" or "arm64" | ||
if [[ "$(uname -m)" == "aarch64" || "$(uname -m)" == "arm64" ]] ; then | ||
arch=arm64 | ||
else | ||
arch=x64 | ||
fi | ||
|
||
# fetch release info | ||
latest_release=$(curl -s https://api.github.com/repos/FilenCloudDienste/filen-cli/releases/latest) | ||
version=$(echo "$latest_release" | grep "tag_name" | cut -d \" -f 4) | ||
download_url=$(echo "$latest_release" | grep "browser_download_url.*$platform-$arch" | cut -d \" -f 4) | ||
|
||
echo "Installing Filen CLI $version ($platform-$arch)" | ||
|
||
# prepare install location ~/.filen-cli | ||
if [ ! -d ~/.filen-cli ] ; then mkdir -p ~/.filen-cli/bin ; fi | ||
|
||
# download binary and make executable | ||
echo "Downloading $download_url..." | ||
curl -o ~/.filen-cli/bin/filen -L --progress-bar $download_url | ||
chmod +x ~/.filen-cli/bin/filen | ||
|
||
# add to PATH | ||
if [[ $PATH == *$(echo ~)/\.filen-cli* ]] ; then | ||
echo "\$PATH already contains ~/.filen-cli" | ||
else | ||
export PATH=$PATH:~/.filen-cli/bin | ||
profileFileFound=0 | ||
for profileFile in ~/.bashrc ~/.bash_profile ~/.zshrc ~/.profile ; do | ||
if [[ -f $profileFile ]] ; then | ||
profileFileFound=1 | ||
printf "\n\n# filen-cli\nPATH=\$PATH:~/.filen-cli/bin\n" >> $profileFile | ||
echo "Added ~/.filen-cli/bin to \$PATH in $profileFile" | ||
fi | ||
done | ||
if [[ $profileFileFound == "0" ]] ; then | ||
echo "ERR: No shell profile file found (checked: ~/.bashrc ~/.bash_profile ~/.zshrc ~/.profile)" | ||
fi | ||
fi | ||
echo "Filen CLI installed as \`filen\` (you might need to restart your shell)" | ||
|
||
echo "To uninstall, delete ~/.filen-cli and revert changes to your shell profile(s)" | ||
|
||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
import arg from "arg" | ||
import FilenSDK from "@filen/sdk" | ||
import path from "path" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.