Trick + cleaning to allow to build the yunohost-admin in the container despite the lack of r/w of the shared folder

This commit is contained in:
Alexandre Aubin 2019-10-09 00:16:43 +02:00
parent ea22e9409d
commit f5a1860aec

36
ynh-dev
View file

@ -147,6 +147,18 @@ function start_ynhdev()
function attach_ynhdev() function attach_ynhdev()
{ {
# We need those link for the yunohost-admin build to work without r/w
# permission in the shared folder.
#
# The target folders (/var/cache/ynh-dev/...) are then created during the
# './ynh-dev use-git yunohost-admin'
if [[ ! -e ./yunohost-admin/src/dist ]]
then
ln -s /var/cache/ynh-dev/yunohost-admin/bower_components ./yunohost-admin/src/
ln -s /var/cache/ynh-dev/yunohost-admin/node_modules ./yunohost-admin/src/
ln -s /var/cache/ynh-dev/yunohost-admin/dist ./yunohost-admin/src/
fi
check_lxd_setup check_lxd_setup
local BOX=${1:-ynh-dev} local BOX=${1:-ynh-dev}
sudo lxc start $BOX 2>/dev/null || true sudo lxc start $BOX 2>/dev/null || true
@ -240,26 +252,28 @@ function use_git()
getent passwd ynhdev > /dev/null getent passwd ynhdev > /dev/null
if [ $? -eq 2 ]; then if [ $? -eq 2 ]; then
useradd ynhdev useradd ynhdev
chown -R ynhdev: /ynh-dev/yunohost-admin
fi fi
mkdir -p /var/cache/ynh-dev/yunohost-admin/{bower_components,node_modules,dist}
chown -R ynhdev /var/cache/ynh-dev/yunohost-admin/{bower_components,node_modules,dist}
# Install npm dependencies if needed # Install npm dependencies if needed
which gulp > /dev/null which gulp > /dev/null
if [ $? -eq 1 ] if [ $? -eq 1 ]
then then
info "Installing dependencies to develop in yunohost-admin ..." info "Installing dependencies to develop in yunohost-admin ..."
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - curl -sL https://deb.nodesource.com/setup_6.x | bash -
sudo apt install nodejs apt install nodejs -y
npm install -g bower
npm install -g gulp
fi
cd /ynh-dev/yunohost-admin/src cd /ynh-dev/yunohost-admin/src
sudo npm install --no-bin-links npm install --no-bin-links
sudo npm install -g bower su ynhdev -c "bower install"
sudo npm install -g gulp su ynhdev -c "gulp build --dev"
fi
cd /ynh-dev/yunohost-admin/src
sudo su -c "bower install" ynhdev
sudo su -c "gulp build --dev" ynhdev
create_sym_link "/ynh-dev/yunohost-admin/src" "/usr/share/yunohost/admin" create_sym_link "/ynh-dev/yunohost-admin/src" "/usr/share/yunohost/admin"
@ -272,7 +286,7 @@ function use_git()
warn "don't need to re-run npm yourself everytime you change " warn "don't need to re-run npm yourself everytime you change "
warn "something ! " warn "something ! "
warn "-------------------------------------------------------- " warn "-------------------------------------------------------- "
sudo su -c "gulp watch --dev" ynhdev su ynhdev -c "gulp watch --dev"
;; ;;
esac esac