update readme
This commit is contained in:
parent
432b250094
commit
7ad7edae9d
46
README.md
46
README.md
@ -1,28 +1,50 @@
|
|||||||
# Sub-Resource Integrity Generator Scripts
|
# Sub-Resource Integrity Generator Scripts
|
||||||
|
|
||||||
Basic scripts to generate SRI hashes for a given file. POSIX-compliant shell script for use on *nix and PowerShell for use on Windows.
|
Basic scripts to generate SRI hashes. POSIX-compliant shell script for use on *nix and PowerShell for use on Windows.
|
||||||
|
|
||||||
|
## common features
|
||||||
|
|
||||||
|
- Hash individual files or a quoted space-delimited list of files.
|
||||||
|
- Hash all files within a specified directory with one command.
|
||||||
|
- Hash a filtered-list of files within a directory with one command.
|
||||||
|
- Process a list of files and a directory (filtered or not) at the same time, saving you typing!
|
||||||
|
|
||||||
## linux script
|
## linux script
|
||||||
|
|
||||||
- This script *requires* openssl be installed and will exit if it cannot find openssl.
|
- This script *requires* openssl be installed and will exit if it cannot find openssl.
|
||||||
- You can rename *sri* to anything you like.
|
- You can rename *sri* to anything you like.
|
||||||
- I suggest copying *sri* somewhere like */usr/local/bin* or */usr/bin* so it can be run easier and from anywhere
|
- I suggest copying *sri* somewhere like */usr/local/bin* or */usr/bin* so it can be run easier and from anywhere (see note below).
|
||||||
- Complete help is included in the script. Simply run without any parameters or run with '*--help*'
|
- Complete help is included in the script. Simply run without any parameters or run with '*--help*'.
|
||||||
|
|
||||||
### examples
|
|
||||||
|
|
||||||
Assuming you have *not* copied the script to your path and it is located in your home directory:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~
|
./sri --help
|
||||||
./sri -f /var/www/css/style.css
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If copied to a directory in your path like */usr/local/bin*, then you can simplify things by running it directly from where the file you want to hash is located:
|
### copy to path location
|
||||||
|
|
||||||
|
Copying the script to a location within your path makes running it more convenient. For example:
|
||||||
|
|
||||||
|
Assuming you store it in your home directory /Downloads and need to hash files in your webroot (eg: /var/www/css/...)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /var/www/css
|
~/SRIhelper/sri -f /var/www/css/style.css
|
||||||
sri -f style.css
|
```
|
||||||
|
|
||||||
|
Whereas, if it's in your path, you can omit the source path and just run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sri -f /var/www/css/style.css
|
||||||
|
```
|
||||||
|
|
||||||
|
To make this work, just copy the file to a location in your path. There are no dependencies or anything to worry about, the file is self-contained and POSIX compliant.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# copy to local/bin
|
||||||
|
cp ~/SRIhelper/sri /usr/local/bin/sri
|
||||||
|
# copy and rename to something else
|
||||||
|
cp ~/SRIhelper/sri /usr/local/bin/hashSRI
|
||||||
|
# copy to your global bin directory (usually local is preferred!)
|
||||||
|
cp ~/SRIhelper/sri /usr/bin/sri
|
||||||
```
|
```
|
||||||
|
|
||||||
### troubleshooting
|
### troubleshooting
|
||||||
|
Loading…
Reference in New Issue
Block a user