-
Notifications
You must be signed in to change notification settings - Fork 0
Standalone bash scripts
For using standalone bash scripts instead of the rust CLI tool
Make sure you have the following dependencies installed on your system:
xclip7zunzipunrar
Make installer executable and run it, you'll need elevated permissions:
chmod +x install.sh
sudo ./install.shYou can specify a custom installation directory by passing it as an argument to the installer, like so:
sudo ./install.sh -p ~/binThe installer does the following:
- Creates a
./.installfile to keep track of the installation. The first line of this file contains the installation directory and the rest of the lines contain the names of the scripts that were installed. - Reads the
./shdirectory to know which scripts to install, for each file it:- Makes the scripts executable.
- Creates a symbolic link of each script in the specified installation directory.
- Adds the script name to the
./.installfile.
Make uninstaller executable and run it, you'll need elevated permissions:
chmod +x uninstall.sh
sudo ./uninstall.shYou can also specify a location for where to read the ./.install file:
sudo ./uninstall.sh -p ~/.installThe installer does the following:
- Searches for the
./.installfile in the specified location.- If the file is found, it:
- For each script in the
./.installfile, it removes the symbolic link from the installation directory.
- For each script in the
- Else, it:
- Defaults to
/usr/local/binas the installation directory. - Reads the
./shdirectory to know which scripts to remove, for each file it:- Removes the symbolic link from the installation directory.
- Defaults to
- If the file is found, it:
- Removes the
./.installfile.
Once installed, you can run any of the scripts from anywhere in your system. Refer to the help message of each script for usage instructions.
backup -hYou can also run the scripts locally by calling them from the sh directory, just make sure to give them execution permissions:
chmod +x ./sh/backup.sh
./sh/backup.sh -hNo additional dependencies are required for local development.
Altough no building is required for this project, a build.sh script is provided to archive the scripts into a .tar.gz file.
This will create a ./dist directory with an archive named shell-scripts-X.Y.Z.tar.gz, where X.Y.Z is the version number of the project; See VERSION file.
chmod +x build.sh
./build.shTests can be written and run using the tests/run.sh script.
This script defines all tests that can be ran for every script in the sh directory.
chmod +x tests/run.sh
./tests/run.shFor every script there should be a corresponding directory in the tests directory with the same name.
Inside this directory there should be any files needed and an optional .expected file that contains the expected output of the script.
The file tree should look like this:
.
├── ...
├── sh
│ ├── backup.sh
│ ├── cln.sh
│ ├── copy.sh
│ ├── hog.sh
│ ├── paste.sh
│ └── xtract.sh
├── tests
│ ├── backup
│ │ ├── .expected
│ │ └── ...
│ ├── cln
│ │ ├── .expected
│ │ └── ...
│ ├── hog
│ │ ├── .expected
│ │ └── ...
│ ├── run.sh
│ └── xtract
│ │ ├── .expected
│ │ └── ...
└── ...