-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuntar_node_modules.sh
More file actions
executable file
·46 lines (37 loc) · 1018 Bytes
/
Copy pathuntar_node_modules.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
ALLARGS="yes"
if [ -z "$1" ] ; then
ALLARGS="no"
fi
if [ -z "$2" ] ; then
ALLARGS="no"
fi
if [ -z "$3" ] ; then
ALLARGS="no"
fi
if [ "$ALLARGS" = "no" ]; then
echo "ERROR: Parameter missing. Did you forget the username?"
echo "-------------------------------------------------------------"
echo "USAGE:"
echo "Compress node tar ball"
echo "-> $0 username owner project"
echo
exit
fi
CHROOT_USERNAME=$1
OWNER=$2
PROJECT=$3
JAILROOT="/jail"
if [ -d "/media/internalStorage" ]; then
JAILROOT="/media/internalStorage"
fi
JAILPATH="$JAILROOT/$CHROOT_USERNAME"
HOMEDIR="$JAILPATH/home/$CHROOT_USERNAME"
NODE_MODULES_FOLDER="$HOMEDIR/$OWNER/$PROJECT/node_modules"
TARBALL_DIR="/node_tarball"
#Compressing node modules folder
if [ -d $TARBALL_DIR ]; then
if [ -f "$TARBALL_DIR/$OWNER-$PROJECT.tar.gz" ]; then
cd "$HOMEDIR/$OWNER/$PROJECT"; tar -xzf "$TARBALL_DIR/$OWNER-$PROJECT.tar.gz"; chown -R $CHROOT_USERNAME:$CHROOT_USERNAME $NODE_MODULES_FOLDER
fi;
fi