mirror of
https://github.com/fsquillace/junest.git
synced 2026-07-25 11:53:56 +00:00
#297 Create bin wrapper for symlinks
This commit is contained in:
parent
21b5e3fabb
commit
100b49c84d
2 changed files with 21 additions and 2 deletions
|
|
@ -25,7 +25,10 @@ function create_wrappers() {
|
|||
cd "${JUNEST_HOME}/usr/bin" || return 1
|
||||
for file in *
|
||||
do
|
||||
[[ -x $file ]] || continue
|
||||
[[ -d $file ]] && continue
|
||||
# Symlinks outside junest appear as broken even though the are correct
|
||||
# within a junest session. The following do not skip broken symlinks:
|
||||
[[ -x $file || -L $file ]] || continue
|
||||
if [[ -e ${JUNEST_HOME}/usr/bin_wrappers/$file ]] && ! $force
|
||||
then
|
||||
continue
|
||||
|
|
@ -47,7 +50,7 @@ EOF
|
|||
cd "${JUNEST_HOME}/usr/bin_wrappers" || return 1
|
||||
for file in *
|
||||
do
|
||||
[[ -e ${JUNEST_HOME}/usr/bin/$file ]] || rm -f "$file"
|
||||
[[ -e ${JUNEST_HOME}/usr/bin/$file || -L ${JUNEST_HOME}/usr/bin/$file ]] || rm -f "$file"
|
||||
done
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,22 @@ function test_create_wrappers_not_executable_file(){
|
|||
assertTrue "myfile wrapper should not exist" "[ ! -x $JUNEST_HOME/usr/bin_wrappers/myfile ]"
|
||||
}
|
||||
|
||||
function test_create_wrappers_directory(){
|
||||
mkdir -p "$JUNEST_HOME"/usr/bin/mydir
|
||||
assertCommandSuccess create_wrappers
|
||||
assertEquals "" "$(cat "$STDOUTF")"
|
||||
assertTrue "bin_wrappers should exist" "[ -e $JUNEST_HOME/usr/bin_wrappers ]"
|
||||
assertTrue "mydir wrapper should not exist" "[ ! -e $JUNEST_HOME/usr/bin_wrappers/mydir ]"
|
||||
}
|
||||
|
||||
function test_create_wrappers_broken_link(){
|
||||
ln -s /opt/myapp/bin/cmd "$JUNEST_HOME"/usr/bin/cmd
|
||||
assertCommandSuccess create_wrappers
|
||||
assertEquals "" "$(cat "$STDOUTF")"
|
||||
assertTrue "bin_wrappers should exist" "[ -e $JUNEST_HOME/usr/bin_wrappers ]"
|
||||
assertTrue "cmd wrapper should exist" "[ -x $JUNEST_HOME/usr/bin_wrappers/cmd ]"
|
||||
}
|
||||
|
||||
function test_create_wrappers_executable_file(){
|
||||
touch "$JUNEST_HOME"/usr/bin/myfile
|
||||
chmod +x "$JUNEST_HOME"/usr/bin/myfile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue