mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-11 08:55:23 +03:00
Add OpenBSD support to shebang script
* use sha1 instead of sha1sum on OpenBSD * enable using runidris regardless of the script's extension * mark runidris scripts executable
This commit is contained in:
parent
b9b32e5b82
commit
f9194a644d
11
scripts/runidris
Normal file → Executable file
11
scripts/runidris
Normal file → Executable file
@ -9,10 +9,17 @@ if [ ! -d $RUNIDRIS_DIR ]; then
|
|||||||
mkdir $RUNIDRIS_DIR
|
mkdir $RUNIDRIS_DIR
|
||||||
chmod 700 $RUNIDRIS_DIR
|
chmod 700 $RUNIDRIS_DIR
|
||||||
fi
|
fi
|
||||||
TEMP_NAME="runidris-`sha1sum $1 | cut -c1-40`"
|
|
||||||
|
OS=`uname -s`
|
||||||
|
case $OS in
|
||||||
|
OpenBSD ) TEMP_NAME="runidris-`sha1 -q $1`" ;;
|
||||||
|
* ) TEMP_NAME="runidris-`sha1sum $1 | cut -c1-40`" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
FP="$RUNIDRIS_DIR/$TEMP_NAME"
|
FP="$RUNIDRIS_DIR/$TEMP_NAME"
|
||||||
|
cp "$1" "$FP.idr" # idris won't compile the script unless it ends in .idr
|
||||||
if [ ! -e $FP ]; then
|
if [ ! -e $FP ]; then
|
||||||
"${IDRIS:-idris}" $1 --ibcsubdir "$RUNIDRIS_DIR" -i "." -o $FP
|
"${IDRIS:-idris}" "$FP.idr" --ibcsubdir "$RUNIDRIS_DIR" -i "." -o $FP
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
"$FP" "$@"
|
"$FP" "$@"
|
||||||
|
15
scripts/runidris-node
Normal file → Executable file
15
scripts/runidris-node
Normal file → Executable file
@ -9,10 +9,17 @@ if [ ! -d $RUNIDRIS_DIR ]; then
|
|||||||
mkdir $RUNIDRIS_DIR
|
mkdir $RUNIDRIS_DIR
|
||||||
chmod 700 $RUNIDRIS_DIR
|
chmod 700 $RUNIDRIS_DIR
|
||||||
fi
|
fi
|
||||||
TEMP_NAME="runidris-`sha1sum $1 | cut -c1-40`.js"
|
|
||||||
|
OS=`uname -s`
|
||||||
|
case $OS in
|
||||||
|
OpenBSD ) TEMP_NAME="runidris-`sha1 -q $1`" ;;
|
||||||
|
* ) TEMP_NAME="runidris-`sha1sum $1 | cut -c1-40`" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
FP="$RUNIDRIS_DIR/$TEMP_NAME"
|
FP="$RUNIDRIS_DIR/$TEMP_NAME"
|
||||||
if [ ! -e $FP ]; then
|
cp "$1" "$FP.idr" # idris won't compile the script unless it ends in .idr
|
||||||
"${IDRIS:-idris}" --codegen node --ibcsubdir "$RUNIDRIS_DIR" -i "." $1 -o $FP
|
if [ ! -e "$FP.js" ]; then
|
||||||
|
"${IDRIS:-idris}" --codegen node --ibcsubdir "$RUNIDRIS_DIR" -i "." "$FP.idr" -o "$FP.js"
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
node "$FP" "$@"
|
node "$FP.js" "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user