This commit is contained in:
BoHung Chiu 2023-02-17 16:59:07 +08:00
parent 76ca8ced90
commit a8f6cb8935
1 changed files with 8 additions and 2 deletions

View File

@ -41,8 +41,13 @@ sig () {
get_orbit_root () { get_orbit_root () {
if [ ! -f $NGINX_ORBIT_SITES/$1 ]; then echo "Site $1 not found" && exit 0; fi if [ ! -f $NGINX_ORBIT_SITES/$1 ]; then echo "Site $1 not found" && exit 0; fi
ORBIT_ROOT=`cat $NGINX_ORBIT_SITES/$1 | grep 'root' | grep -v '#' | xargs | awk '{print $2}'`; tmp_roots=`cat $NGINX_ORBIT_SITES/$1 | grep -E '^\s*root' | awk '{print $2}' | sed -E 's/;.*//g'| sed -E 's/\/public$//g'`;
ORBIT_ROOT="${ORBIT_ROOT//"/public;"/""}"; ORBIT_ROOT="";
for d in $tmp_roots; do
if [ -d "$d" ]; then
ORBIT_ROOT="$d";
fi;
done
if [ ! -d "$ORBIT_ROOT" ]; then if [ ! -d "$ORBIT_ROOT" ]; then
echo "Site folder $ORBIT_ROOT not found"; echo "Site folder $ORBIT_ROOT not found";
ORBIT_ROOT=""; ORBIT_ROOT="";
@ -59,6 +64,7 @@ bundle_orbit () {
if [[ -z $args ]]; then if [[ -z $args ]]; then
args="install" args="install"
fi fi
echo "Execing bundle install in $ORBIT_ROOT";
sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle $args"; sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle $args";
} }
case $1 in case $1 in