Commit bd8a3db4 authored by Pierre-Yves Fourmond's avatar Pierre-Yves Fourmond

Fixed Issue #54

parent b124e8c5
......@@ -455,6 +455,7 @@ To get help of `liar` usage, simply enter:
-l Create symbolic links in /home/user/bin folder after installation.
-s Specify the folder for SYMBOLIC links creation.
-p Specify the file PATTERN(s) to restrict symbolic links creation.
-n Use -name find flag instead of default -wholename flag for executables search.
-u Specify the download user AGENT: wget, curl or aria2c. By default, wget is used.
-e Use content disposition header.
-c Specify the file path expected CHECKSUM.
......@@ -621,6 +622,7 @@ Symbolic links creation options are:
- folder for SYMBOLIC links creation
- file PATTERN(s) for SYMBOLIC links
- find TYPE for executables search
Command parameters are:
......@@ -649,23 +651,6 @@ FILE_PATH is the path of the archive containing the software to install.
The FILE_PATH parameter is specific to the install command.
#### Symbolic links creation
After a software is installed `liar` can optionally create symbolic links for installed executables to a folder of your choice, the folder for SYMBOLIC links creation.
Symlinking can be done for all or only some of the executables installed.
In this case the file PATTERN(s) used to filter the executables to symlink is(are) a(some) pattern(s) understood by the **find** command **-wholename** flag.
Multiple patterns should be separated by `|`.
For convenience, an initial `*` is added to the beginning of each pattern if not already present.
The folder for SYMBOLIC links creation is optional and has the following default values:
- `/usr/local/bin` for root installation
- `$HOME/bin` otherwise
#### Verbose mode
When option `-v` is set, verbose mode is activated. In this mode, some commands display more detailed output when executed.
......@@ -706,6 +691,25 @@ For example:
$ liar -t sha256 -c a5a4f948d259734ac5649122d0c2f7e885b48162cde78e43415638cbfd7a7aa3 install idea_community https://download-cf.jetbrains.com/idea/ideaIC-2018.1.1.tar.gz
#### Symbolic links creation
After a software is installed `liar` can optionally create symbolic links for installed executables to a folder of your choice, the folder for SYMBOLIC links creation.
Symlinking can be done for all or only some of the executables installed.
In this case, the file PATTERN(s) used to filter the executables to symlink is(are) a(some) pattern(s) understood by the **find** command **-wholename** flag (by default).
If `-n` flag is used, the **find** command **-name** flag is used instead.
Multiple patterns should be separated by `|`.
For convenience, an initial `*` is added to the beginning of each pattern if not already present.
The folder for SYMBOLIC links creation is optional and has the following default values:
- `/usr/local/bin` for root installation
- `$HOME/bin` otherwise
### Configuration files
`liar` uses two configuration files located in `$HOME`.
......
......@@ -35,6 +35,7 @@ Usage: $LIAR [OPTIONS...] COMMAND [PARAMETERS...]
-l Create symbolic links in $HOME/bin folder after installation.
-s Specify the folder for SYMBOLIC links creation.
-p Specify the file PATTERN(s) to restrict symbolic links creation.
-n Use -name find flag instead of default -wholename flag for executables search.
-u Specify the download user AGENT: wget, curl or aria2c. By default, wget is used.
-e Use content disposition header.
-c Specify the file path expected CHECKSUM.
......@@ -454,7 +455,7 @@ create_links_for_pattern() {
if [ "$(expr substr "$bin_pattern" 1 1)" != "*" ]; then
bin_pattern="*$bin_pattern"
fi
exec_names=$(find "$INSTALL_FOLDER" -type f -executable -wholename "$bin_pattern")
exec_names=$(find "$INSTALL_FOLDER" -type f -executable -$FIND_TYPE "$bin_pattern")
if [ -n "$exec_names" ]; then
install_links="$INSTALL_FOLDER/.liar_links"
for exec_name in $exec_names; do
......@@ -497,7 +498,7 @@ parse() {
# Parse options
# Reset getopts in case it has been previously used in the shell
OPTIND=1
while getopts ":ls:p:u:evrd:bfc:t:S:" opt; do
while getopts ":ls:p:nu:evrd:bfc:t:S:" opt; do
case "$opt" in
l) CREATE_LINKS="true"
;;
......@@ -505,6 +506,9 @@ parse() {
;;
p) set_arg BIN_PATTERNS "$OPTARG" || return 1
;;
n) FIND_TYPE="name"
echo "Using -name find type"
;;
u) case "$OPTARG" in
wget | curl | aria2c)
USER_AGENT=$OPTARG
......@@ -618,6 +622,10 @@ parse() {
BIN_PATTERNS="*"
fi
if [ -z "$FIND_TYPE" ]; then
FIND_TYPE="wholename"
fi
if [ -z "$USER_AGENT" ]; then
USER_AGENT="wget"
fi
......
......@@ -30,7 +30,7 @@ URL=https://$GIT_SERVER/grumpyf0x48/liar/raw/master
VERSION=0.2-dev
ALL_COMMANDS="help install list remove version upgrade"
ALL_OPTIONS="-d -l -s -p -a -c -t -S -v -r -b -f"
ALL_OPTIONS="-d -l -s -p -n -a -c -t -S -v -r -b -f"
SOFTWARE_FILE="$HOME/.liar_software"
_liar_update_software_file() {
......@@ -153,7 +153,7 @@ _liar_complete_options() {
COMPREPLY=($(compgen -W "md5 sha1 sha256 sha512" -- "$cur"))
return 0
;;
"-l" | "-r")
"-l" | "-r" | "-e" | "-v" | "-b" | "-n")
# Complete with the available commands if not already present
if ! _liar_has_command; then
COMPREPLY=($(compgen -W "$ALL_COMMANDS" -- "$cur"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment