Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds an install script for aescrypt Rust #8

Merged
merged 9 commits into from
Oct 9, 2017

Conversation

baptistecolin
Copy link
Contributor

Adds an install.sh shell script which retrieves aescrypt and Rust.
If the script is hosted at www.myadress.com/path, then it can be executed by firing the following command :

curl www.myadress.com/path | sh

Should the script also execute
cargo build --release
sudo cp target/release/abrute /usr/bin/ ?

@danielpclark
Copy link
Owner

danielpclark commented Oct 7, 2017

@baptistecolin The install script should work as follows:

  • First — check if Rust is installed or not. If it is installed skip to next step. If not notify the user that Rust needs to be installed to continue and ask if they want to continue. If they say yes install Rust. If no stop the installation.
  • Second — check is aescrypt is installed or not. If not install it.
  • Third — download abrute source code, run cargo build release and sudo cp target/release/abrute /usr/bin/
  • Fourth — Say “Thank you for installing abrute! Enjoy!”

@baptistecolin
Copy link
Contributor Author

Here you go, now it should only install Rust and/or Aescrypt if they are not already installed. Then it should carry on with the rest of the installation, making Abrute ready to be used.

Let me now if you had something else in mind

@danielpclark
Copy link
Owner

danielpclark commented Oct 8, 2017

It looks really good so far! Thanks… two more things. For aescrypt installation we don't need to ask the user for permission, it's an extremely small dependency so we'll install it without asking if it's not installed. It's understood that that is a dependency and we only need one confirmation for proceeding with the install.

And lastly the last step only works if a person is in the current project directory with all of the source files. So if they wanted to install it like Rust is installed with curl install-script-from-url | sh then they wouldn't have the files to run cargo build --release with.

So for the abrute install part it should check if the folders .git and src exist before doing what you have. If those folders don't exist the download https://github.com/danielpclark/abrute/archive/master.zip with wget, extract, go into the directory, run the commands you have, then exit the directory and remove the installation files.

@baptistecolin
Copy link
Contributor Author

Here you go, I tried it on my machine and launching ./install.sh installs Abrute from scratch !
Just one thing, due to some syntax tricks I used, curl install-script-url | sh wouldn't work. Please use curl install-script-url | bash instead.

@danielpclark danielpclark self-requested a review October 9, 2017 09:52
Copy link
Owner

@danielpclark danielpclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 33 looks to be an uncommented comment which as far as I know won't work in a shell script

install.sh Outdated
echo "Aescrypt already installed"
else
echo "Installing Aescrypt"
User agreed, proceed with installation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely

@danielpclark danielpclark merged commit b1dc481 into danielpclark:master Oct 9, 2017
@danielpclark
Copy link
Owner

Excellent work @baptistecolin ! 🎉

@baptistecolin
Copy link
Contributor Author

In this particular case, the expression is between brackets : [[ $rust_install_status == $rustc_prefix* ]]
I'm testing if the first string matches a certain pattern.
If Rust is installed, then $rust_install_status will be something like rustc 1.20.0 (f3d6973f4 2017-08-27). If it's not, then it will be something like "The "rustc" command could't be found [...]".
So, if rustc is a prefix of $rust_install_status, it means Rust is installed.
I defined $rustc_prefix to be equal to rustc. Adding a * after means "whatever after $rustc_prefix is ok". This way, if $rust_install_prefix starts with "rustc", the test will return true and the if/then/else statement will do what I want :)

@danielpclark
Copy link
Owner

Got it. Thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants