1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

nuxfs: Small fixes.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2017-06-10 22:42:31 +02:00
parent 5d69659e3c
commit 7479fb53f8
6 changed files with 108 additions and 32 deletions

View file

@ -6,8 +6,8 @@ dir.check.recover() {
}
link.check.recover() {
nuxfs.info "$rel_path" "Creating link to '$3'";
ln -s "$3" "$abs_path"
ln -s "$target" "$abs_path"
}
git.check.recover() {
$GIT_BIN clone "$3" "$abs_path"
$GIT_BIN clone "$origin" "$abs_path"
}

View file

@ -7,21 +7,20 @@ link.entered() {
return
fi
local REAL_LINK=$(readlink "$abs_path")
local TARGET="$3";
nux.log trace "Target is: $TARGET, real link: $REAL_LINK"
if test ! "$REAL_LINK" = "$TARGET"; then
nux.log trace "Target is: $target, real link: $REAL_LINK"
if test ! "$REAL_LINK" = "$target"; then
MAT_REAL=$(realpath "$REAL_LINK")
local cdir=$(dirname "$abs_path")
MAT_TARGET=$(realpath "$cdir/$TARGET")
MAT_TARGET=$(realpath "$cdir/$target")
if test "$MAT_REAL" = "$MAT_TARGET"; then
nuxfs.warning "$rel_path" "is using different definition for target '$3'"
else
nuxfs.error "$rel_path" "links to $REAL_LINK instead of $TARGET"
nuxfs.error "$rel_path" "links to $REAL_LINK instead of $target"
return
fi
fi
if test ! -e "$abs_path"; then
nuxfs.warning "$rel_path" "target '$NC_White$TARGET$NC_No' does not exists."
nuxfs.warning "$rel_path" "target '$NC_White$target$NC_No' does not exists."
fi
}
@ -31,9 +30,9 @@ git.entered() {
nuxfs.error "$rel_path" "is not git repository"
return
fi
local remotes=$(grep "$3" "$rel_path/.git/config" | wc -l)
local remotes=$(grep "$origin" "$rel_path/.git/config" | wc -l)
if [ $remotes -eq 0 ]; then
nuxfs.error "$rel_path" "Does not refer git remote '$3'"
nuxfs.error "$rel_path" "Does not refer git remote '$origin'"
return;
fi
}

View file

@ -1,3 +1,5 @@
#/bin/sh
.block dir name
.keyword link name target
.keyword git name origin
@ -5,6 +7,7 @@
.keyword name name
.keyword template
.keyword exists
.keyword should-not-exists
directory() {
dir
@ -25,8 +28,22 @@ sdir() {
nux.check.file.exists "$abs_path"
}
should-not-exists.check() {
nux.log trace "Checking existence of $NC_White$abs_path$NC_No"
if nux.check.file.exists "$abs_path"; then
return 1
fi
return 0
}
should-not-exists.check.failed() {
for f in "$rel_path"; do
nux.dsl.error $f Should not exists, but is present.
done
}
.check.failed() {
nux.dsl.error "$abs_path" does not exists.
nux.dsl.error "$rel_path" does not exists.
}
dir.entered() {
if nux.check.file.exists "$abs_path/.nuxfs"; then