1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00
nux-env/bin/nuxfs
Tony Tkacik 531f55f249 Splitted nuxfs into components.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2016-11-11 19:55:34 +01:00

53 lines
1 KiB
Text
Executable file

#!/usr/bin/env nux-runner
### Filesystem Layout manager
###
STARTDIR=$(pwd)
nux.include nuxfs
nux.include nuxfs.dsl
## verify - Verifies that directory matches nuxfs specification
function task.verify {
link-exists() {
nux.log debug "Testing '$1' as link"
if test ! -h "$1"; then
nuxfs.error "$1" "is not symlink."
return
fi
local REAL_LINK=$(readlink "$1")
local TARGET="$2";
if test ! "$REAL_LINK" = "$TARGET"; then
nuxfs.error "$1" "links to $REAL_LINK instead of $TARGET"
return
fi
if test ! -e "$1"; then
nuxfs.warning "$1" "target '$NC_White$2$NC_No' does not exists."
fi
}
def-notexists() {
nuxfs.error "$1" "does not exists".
}
nuxfs.dsl.execute .nuxfs
}
## create - Creates missing files as described in nuxfs definition.
function task.create {
directory-notexists() {
nuxfs.info "$1" "Created directory";
mkdir -p "$1"
}
link-notexists() {
nuxfs.info "$1" "Creating link to '$2'";
ln -s "$2" "$1"
}
git-notexists() {
log.warning "Not implemented";
}
nuxfs.dsl.execute .nuxfs
}