#!/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 }