From e499ba803f5e08ecb233d3a026493983f4a20412 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:29:16 +0200 Subject: [PATCH 01/26] Use opi/yunohost boxes for testing purpose. --- ynh-dev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ynh-dev b/ynh-dev index 51e43e1..d15f4ed 100755 --- a/ynh-dev +++ b/ynh-dev @@ -85,11 +85,11 @@ elif [ "$1" = "create-env" ]; then git clone -b unstable https://github.com/YunoHost/moulinette moulinette # Get YunoHost Vagrantfile - git clone https://github.com/YunoHost/Vagrantfile vagrant + git clone -b opi-boxes https://github.com/YunoHost/Vagrantfile vagrant ln -s vagrant/Vagrantfile Vagrantfile # Get YunoHost dev tools - git clone https://github.com/YunoHost/ynh-dev ynh-dev-tools + git clone -b opi-boxes https://github.com/YunoHost/ynh-dev ynh-dev-tools cp ynh-dev-tools/ynh-dev ynh-dev # cp $pwd/$0 ./$0 From 6b62393760d3b192d7764cc0200b44144c5441fe Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:40:14 +0200 Subject: [PATCH 02/26] Fix 'ynh-dev run' documentation: remove VM provider. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f3c332..4512c15 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ ynh-dev create-env /path/to/dev/env ### Run a container ``` cd /path/to/dev/env -ynh-dev run ynh.local virtualbox testing +ynh-dev run ynh.local testing ``` ## Inside the Virtual machine (VM) From 270cdef853e2f71ee83faed81f8d31fbd3c71f9e Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:40:28 +0200 Subject: [PATCH 03/26] Fix initial download link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4512c15..7f66bb3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ sudo dnf install vagrant vagrant-libvirt Next download ynh-dev script ```shell -wget https://raw.githubusercontent.com/zamentur/yunohost-development/master/ynh-dev +wget https://github.com/YunoHost/ynh-dev/raw/opi-boxes/ynh-dev chmod u+x ynh-dev ``` From c5e32076b5dd08b4ac65d4acbb7a9a667a973237 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:52:35 +0200 Subject: [PATCH 04/26] Fix ynh-dev path inside the VM. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7f66bb3..dd30d28 100644 --- a/README.md +++ b/README.md @@ -45,22 +45,22 @@ advantages of the `ynh-dev` script. ### Upgrade the container ``` -ynh-dev/ynh-dev upgrade +/vagrant/ynh-dev upgrade ``` ### Deploy your change ``` -ynh-dev/ynh-dev deploy +/vagrant/ynh-dev deploy ``` ### Deploy your change in realtime (each time you saved source code) ``` -ynh-dev/ynh-dev watch +/vagrant/ynh-dev watch ``` ### Get ip address of your vm ``` -ynh-dev/ynh-dev ip +/vagrant/ynh-dev ip ``` ## More info From 6802e648f708104d31ecec27f52455659d59aadf Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:59:03 +0200 Subject: [PATCH 05/26] Remove --debug flag when running VM. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index d15f4ed..439a5bd 100755 --- a/ynh-dev +++ b/ynh-dev @@ -105,7 +105,7 @@ elif [ "$1" = "run" ]; then VERSION=$3 fi - vagrant up --debug $VERSION + vagrant up $VERSION vagrant ssh $VERSION From 474bd42d5c1e68e9bf068c89cf51da1447362dee Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 09:59:27 +0200 Subject: [PATCH 06/26] Add user message about domain/ip and hosts file. --- ynh-dev | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ynh-dev b/ynh-dev index 439a5bd..e1b6678 100755 --- a/ynh-dev +++ b/ynh-dev @@ -105,6 +105,19 @@ elif [ "$1" = "run" ]; then VERSION=$3 fi + if [ "$VERSION" = "stable" ]; then + IP="192.168.33.80" + elif [ "$VERSION" = "testing" ]; then + IP="192.168.33.81" + elif [ "$VERSION" = "unstable" ]; then + IP="192.168.33.82" + fi + + echo "Creating $DOMAIN virtual machine with YunoHost $VERSION version" + echo "" + echo "/!\ Please add '$IP $DOMAIN' to your /etc/hosts file /!\\" + echo "" + vagrant up $VERSION vagrant ssh $VERSION From 4090eae816d9845adbdda639462d5e5424e86952 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 12:21:57 +0200 Subject: [PATCH 07/26] Fix typo in help --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index e1b6678..cd0f8e4 100755 --- a/ynh-dev +++ b/ynh-dev @@ -6,7 +6,7 @@ Usage : On the host `basename $0` create-env PATH - Create a dev environement into PATH + Create a dev environment into PATH `basename $0` run DOMAIN [VERSION] Run a vagrant or virtualbox vm # `basename $0` kill From f4569111e66f6c0a4976f12524114506e327fffc Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 12:22:14 +0200 Subject: [PATCH 08/26] Fix bashism in deploy command. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index cd0f8e4..81b7688 100755 --- a/ynh-dev +++ b/ynh-dev @@ -161,7 +161,7 @@ elif [ "$1" = "deploy" ]; then cd $BASE_DIR/moulinette ./setup.py install cd .. - [-e "./cache/moulinette/actionsmap/yunohost.pkl"] && rm /var/cache/moulinette/actionsmap/yunohost.pkl + [ -e "./cache/moulinette/actionsmap/yunohost.pkl" ] && rm /var/cache/moulinette/actionsmap/yunohost.pkl echo "moulinette deployed" ;; ssowat) From e2773be4ba47671fce7930f00968b54671f0c1af Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 12:26:11 +0200 Subject: [PATCH 09/26] Add 'use-git' command. --- README.md | 19 +++++++++++ ynh-dev | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/README.md b/README.md index dd30d28..cbfa280 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,29 @@ Once logged into your VM, go to `/vagrant` to enjoy folder sharing, and take advantages of the `ynh-dev` script. ### Upgrade the container + +It will update every debian packages. ``` /vagrant/ynh-dev upgrade ``` +### Use Git repositories + +When doing `create-env` command, every YunoHost package have been cloned in the +corresponding path. Use these Git repositories inside the VM (with symlink). +Your changes will be available immediatly in your VM. +``` +/vagrant/ynh-dev use-git +``` + +***Note***: These changes can be reverted now. + +Alternatively you can use Git only for one packages (ssowat, yunohost, +moulinette, yunohost-admin) +``` +/vagrant/ynh-dev use-git PACKAGE_NAME +``` + ### Deploy your change ``` /vagrant/ynh-dev deploy diff --git a/ynh-dev b/ynh-dev index 81b7688..c924d56 100755 --- a/ynh-dev +++ b/ynh-dev @@ -17,6 +17,8 @@ Usage : Give the ip of the guest container `basename $0` upgrade Upgrade the container + `basename $0` use-git [PACKAGES [PACKAGES ...]] + Use Git repositories from dev environment path `basename $0` deploy [PACKAGES [PACKAGES ...]] Deploy sources to test it `basename $0` watch [PACKAGES [PACKAGES ...]] @@ -152,6 +154,101 @@ elif [ "$1" = "ip" ]; then echo "IP: $ip" +########################################### +## Use Git version for YunoHost packages ## +########################################### +elif [ "$1" = "use-git" ]; then + check_yunohost_vm + VERSION=$2 + + # Get absolute base dir + REPO_DIR=$(realpath $BASE_DIR) + + for i in ${!packages[@]}; do + case ${packages[i]} in + ssowat) + echo "Using Git repository for SSOwat" + # Remove current sources if not a symlink + if [ ! -L '/usr/share/ssowat' ]; then + sudo rm -rf /usr/share/ssowat + fi + # Symlink from Git repository + sudo ln -s -f $REPO_DIR/ssowat /usr/share/ssowat + echo "↳ Don't forget to do 'sudo yunohost app ssowatconf' when hacking SSOwat" + echo "" + ;; + moulinette) + echo "Warning, can't use Git repository for moulinette" + echo "" + ;; + yunohost) + echo "Using Git repository for yunohost" + + # bin + if [ ! -L '/usr/bin/yunohost' ]; then sudo rm /usr/bin/yunohost; fi + sudo ln -s -f $REPO_DIR/yunohost/bin/yunohost /usr/bin/yunohost + if [ ! -L '/usr/bin/yunohost-api' ]; then sudo rm /usr/bin/yunohost-api; fi + sudo ln -s -f $REPO_DIR/yunohost/bin/yunohost-api /usr/bin/yunohost-api + + # data + if [ ! -L '/etc/bash_completion.d/yunohost' ]; then sudo rm /etc/bash_completion.d/yunohost; fi + sudo ln -s -f $REPO_DIR/yunohost/data/bash-completion.d/yunohost /etc/bash_completion.d/yunohost + if [ ! -L '/usr/share/moulinette/actionsmap/yunohost.yml' ]; then sudo rm /usr/share/moulinette/actionsmap/yunohost.yml; fi + sudo ln -s -f $REPO_DIR/yunohost/data/actionsmap/yunohost.yml /usr/share/moulinette/actionsmap/yunohost.yml + if [ ! -L '/usr/share/yunohost/hooks' ]; then sudo rm -rf /usr/share/yunohost/hooks; fi + sudo ln -s -f $REPO_DIR/yunohost/data/hooks /usr/share/yunohost/hooks + if [ ! -L '/usr/share/yunohost/templates' ]; then sudo rm -rf /usr/share/yunohost/templates; fi + sudo ln -s -f $REPO_DIR/yunohost/data/templates /usr/share/yunohost/templates + if [ ! -L '/usr/share/yunohost/helpers' ]; then sudo rm /usr/share/yunohost/helpers; fi + sudo ln -s -f $REPO_DIR/yunohost/data/helpers /usr/share/yunohost/helpers + if [ ! -L '/usr/share/yunohost/helpers.d' ]; then sudo rm -rf /usr/share/yunohost/helpers.d; fi + sudo ln -s -f $REPO_DIR/yunohost/data/helpers.d /usr/share/yunohost/helpers.d + if [ ! -L '/usr/share/yunohost/yunohost-config/moulinette' ]; then sudo rm -rf /usr/share/yunohost/yunohost-config/moulinette; fi + sudo ln -s -f $REPO_DIR/yunohost/data/others /usr/share/yunohost/yunohost-config/moulinette + + # debian + if [ ! -L '/usr/share/pam-configs/mkhomedir' ]; then sudo rm /usr/share/pam-configs/mkhomedir; fi + sudo ln -s -f $REPO_DIR/yunohost/debian/conf/pam/mkhomedir /usr/share/pam-configs/mkhomedir + + # lib + if [ ! -L '/usr/lib/metronome/modules/ldap.lib.lua' ]; then sudo rm /usr/lib/metronome/modules/ldap.lib.lua; fi + sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/ldap.lib.lua /usr/lib/metronome/modules/ldap.lib.lua + if [ ! -L '/usr/lib/metronome/modules/mod_auth_ldap2.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_auth_ldap2.lua; fi + sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_auth_ldap2.lua /usr/lib/metronome/modules/mod_auth_ldap2.lua + if [ ! -L '/usr/lib/metronome/modules/mod_legacyauth.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_legacyauth.lua; fi + sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_legacyauth.lua /usr/lib/metronome/modules/mod_legacyauth.lua + if [ ! -L '/usr/lib/metronome/modules/mod_storage_ldap.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_storage_ldap.lua; fi + sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_storage_ldap.lua /usr/lib/metronome/modules/mod_storage_ldap.lua + if [ ! -L '/usr/lib/metronome/modules/vcard.lib.lua' ]; then sudo rm /usr/lib/metronome/modules/vcard.lib.lua; fi + sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/vcard.lib.lua /usr/lib/metronome/modules/vcard.lib.lua + + # locales + if [ ! -L '/usr/lib/moulinette/yunohost/locales' ]; then sudo rm -rf /usr/lib/moulinette/yunohost/locales; fi + sudo ln -s -f $REPO_DIR/yunohost/locales /usr/lib/moulinette/yunohost/locales + + # src + if [ ! -L '/usr/lib/moulinette/yunohost' ]; then sudo rm -rf /usr/lib/moulinette/yunohost; fi + sudo ln -s -f $REPO_DIR/yunohost/src/yunohost /usr/lib/moulinette/yunohost + + # Remove actionsmap cache + [ -e '/var/cache/moulinette/actionsmap/yunohost.pkl' ] && sudo rm /var/cache/moulinette/actionsmap/yunohost.pkl + echo "↳ Don't forget to remove '/var/cache/moulinette/actionsmap/yunohost.pkl' cache when hacking SSOwat" + echo "" + ;; + yunohost-admin) + echo "Using Git repository for yunohost-admin" + # Remove current sources if not a symlink + if [ ! -L '/usr/share/yunohost/admin' ]; then + sudo rm -rf /usr/share/yunohost/admin + fi + # Symlink from Git repository + sudo ln -s -f $REPO_DIR/yunohost-admin/src /usr/share/yunohost/admin + echo "↳ Don't forget to do build admin with Gulp when hacking yunohost-admin. See README file" + echo "" + ;; + esac + done + elif [ "$1" = "deploy" ]; then check_yunohost_vm for i in ${!packages[@]}; do From e4316b099d376e343ba537dbdb3ca4745559727b Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:05:28 +0200 Subject: [PATCH 10/26] Fix typo. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index c924d56..01997de 100755 --- a/ynh-dev +++ b/ynh-dev @@ -232,7 +232,7 @@ elif [ "$1" = "use-git" ]; then # Remove actionsmap cache [ -e '/var/cache/moulinette/actionsmap/yunohost.pkl' ] && sudo rm /var/cache/moulinette/actionsmap/yunohost.pkl - echo "↳ Don't forget to remove '/var/cache/moulinette/actionsmap/yunohost.pkl' cache when hacking SSOwat" + echo "↳ Don't forget to remove '/var/cache/moulinette/actionsmap/yunohost.pkl' cache when hacking yunohost" echo "" ;; yunohost-admin) From b2e9e6b108c917ab9e6d9100575fe70af465a421 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:12:17 +0200 Subject: [PATCH 11/26] Don't try to be smart in a bash script. --- ynh-dev | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/ynh-dev b/ynh-dev index 01997de..70a5a98 100755 --- a/ynh-dev +++ b/ynh-dev @@ -161,9 +161,6 @@ elif [ "$1" = "use-git" ]; then check_yunohost_vm VERSION=$2 - # Get absolute base dir - REPO_DIR=$(realpath $BASE_DIR) - for i in ${!packages[@]}; do case ${packages[i]} in ssowat) @@ -173,7 +170,7 @@ elif [ "$1" = "use-git" ]; then sudo rm -rf /usr/share/ssowat fi # Symlink from Git repository - sudo ln -s -f $REPO_DIR/ssowat /usr/share/ssowat + sudo ln -s -f /vagrant/ssowat /usr/share/ssowat echo "↳ Don't forget to do 'sudo yunohost app ssowatconf' when hacking SSOwat" echo "" ;; @@ -186,49 +183,49 @@ elif [ "$1" = "use-git" ]; then # bin if [ ! -L '/usr/bin/yunohost' ]; then sudo rm /usr/bin/yunohost; fi - sudo ln -s -f $REPO_DIR/yunohost/bin/yunohost /usr/bin/yunohost + sudo ln -s -f /vagrant/yunohost/bin/yunohost /usr/bin/yunohost if [ ! -L '/usr/bin/yunohost-api' ]; then sudo rm /usr/bin/yunohost-api; fi - sudo ln -s -f $REPO_DIR/yunohost/bin/yunohost-api /usr/bin/yunohost-api + sudo ln -s -f /vagrant/yunohost/bin/yunohost-api /usr/bin/yunohost-api # data if [ ! -L '/etc/bash_completion.d/yunohost' ]; then sudo rm /etc/bash_completion.d/yunohost; fi - sudo ln -s -f $REPO_DIR/yunohost/data/bash-completion.d/yunohost /etc/bash_completion.d/yunohost + sudo ln -s -f /vagrant/yunohost/data/bash-completion.d/yunohost /etc/bash_completion.d/yunohost if [ ! -L '/usr/share/moulinette/actionsmap/yunohost.yml' ]; then sudo rm /usr/share/moulinette/actionsmap/yunohost.yml; fi - sudo ln -s -f $REPO_DIR/yunohost/data/actionsmap/yunohost.yml /usr/share/moulinette/actionsmap/yunohost.yml + sudo ln -s -f /vagrant/yunohost/data/actionsmap/yunohost.yml /usr/share/moulinette/actionsmap/yunohost.yml if [ ! -L '/usr/share/yunohost/hooks' ]; then sudo rm -rf /usr/share/yunohost/hooks; fi - sudo ln -s -f $REPO_DIR/yunohost/data/hooks /usr/share/yunohost/hooks + sudo ln -s -f /vagrant/yunohost/data/hooks /usr/share/yunohost/hooks if [ ! -L '/usr/share/yunohost/templates' ]; then sudo rm -rf /usr/share/yunohost/templates; fi - sudo ln -s -f $REPO_DIR/yunohost/data/templates /usr/share/yunohost/templates + sudo ln -s -f /vagrant/yunohost/data/templates /usr/share/yunohost/templates if [ ! -L '/usr/share/yunohost/helpers' ]; then sudo rm /usr/share/yunohost/helpers; fi - sudo ln -s -f $REPO_DIR/yunohost/data/helpers /usr/share/yunohost/helpers + sudo ln -s -f /vagrant/yunohost/data/helpers /usr/share/yunohost/helpers if [ ! -L '/usr/share/yunohost/helpers.d' ]; then sudo rm -rf /usr/share/yunohost/helpers.d; fi - sudo ln -s -f $REPO_DIR/yunohost/data/helpers.d /usr/share/yunohost/helpers.d + sudo ln -s -f /vagrant/yunohost/data/helpers.d /usr/share/yunohost/helpers.d if [ ! -L '/usr/share/yunohost/yunohost-config/moulinette' ]; then sudo rm -rf /usr/share/yunohost/yunohost-config/moulinette; fi - sudo ln -s -f $REPO_DIR/yunohost/data/others /usr/share/yunohost/yunohost-config/moulinette + sudo ln -s -f /vagrant/yunohost/data/others /usr/share/yunohost/yunohost-config/moulinette # debian if [ ! -L '/usr/share/pam-configs/mkhomedir' ]; then sudo rm /usr/share/pam-configs/mkhomedir; fi - sudo ln -s -f $REPO_DIR/yunohost/debian/conf/pam/mkhomedir /usr/share/pam-configs/mkhomedir + sudo ln -s -f /vagrant/yunohost/debian/conf/pam/mkhomedir /usr/share/pam-configs/mkhomedir # lib if [ ! -L '/usr/lib/metronome/modules/ldap.lib.lua' ]; then sudo rm /usr/lib/metronome/modules/ldap.lib.lua; fi - sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/ldap.lib.lua /usr/lib/metronome/modules/ldap.lib.lua + sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/ldap.lib.lua /usr/lib/metronome/modules/ldap.lib.lua if [ ! -L '/usr/lib/metronome/modules/mod_auth_ldap2.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_auth_ldap2.lua; fi - sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_auth_ldap2.lua /usr/lib/metronome/modules/mod_auth_ldap2.lua + sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/mod_auth_ldap2.lua /usr/lib/metronome/modules/mod_auth_ldap2.lua if [ ! -L '/usr/lib/metronome/modules/mod_legacyauth.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_legacyauth.lua; fi - sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_legacyauth.lua /usr/lib/metronome/modules/mod_legacyauth.lua + sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/mod_legacyauth.lua /usr/lib/metronome/modules/mod_legacyauth.lua if [ ! -L '/usr/lib/metronome/modules/mod_storage_ldap.lua' ]; then sudo rm /usr/lib/metronome/modules/mod_storage_ldap.lua; fi - sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/mod_storage_ldap.lua /usr/lib/metronome/modules/mod_storage_ldap.lua + sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/mod_storage_ldap.lua /usr/lib/metronome/modules/mod_storage_ldap.lua if [ ! -L '/usr/lib/metronome/modules/vcard.lib.lua' ]; then sudo rm /usr/lib/metronome/modules/vcard.lib.lua; fi - sudo ln -s -f $REPO_DIR/yunohost/lib/metronome/modules/vcard.lib.lua /usr/lib/metronome/modules/vcard.lib.lua + sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/vcard.lib.lua /usr/lib/metronome/modules/vcard.lib.lua # locales if [ ! -L '/usr/lib/moulinette/yunohost/locales' ]; then sudo rm -rf /usr/lib/moulinette/yunohost/locales; fi - sudo ln -s -f $REPO_DIR/yunohost/locales /usr/lib/moulinette/yunohost/locales + sudo ln -s -f /vagrant/yunohost/locales /usr/lib/moulinette/yunohost/locales # src if [ ! -L '/usr/lib/moulinette/yunohost' ]; then sudo rm -rf /usr/lib/moulinette/yunohost; fi - sudo ln -s -f $REPO_DIR/yunohost/src/yunohost /usr/lib/moulinette/yunohost + sudo ln -s -f /vagrant/yunohost/src/yunohost /usr/lib/moulinette/yunohost # Remove actionsmap cache [ -e '/var/cache/moulinette/actionsmap/yunohost.pkl' ] && sudo rm /var/cache/moulinette/actionsmap/yunohost.pkl @@ -242,7 +239,7 @@ elif [ "$1" = "use-git" ]; then sudo rm -rf /usr/share/yunohost/admin fi # Symlink from Git repository - sudo ln -s -f $REPO_DIR/yunohost-admin/src /usr/share/yunohost/admin + sudo ln -s -f /vagrant/yunohost-admin/src /usr/share/yunohost/admin echo "↳ Don't forget to do build admin with Gulp when hacking yunohost-admin. See README file" echo "" ;; From 87b1e077b26957c643e144eb2aa062c63c3bb68a Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:23:30 +0200 Subject: [PATCH 12/26] Use symlink for ynh-dev script for easier updates. --- ynh-dev | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ynh-dev b/ynh-dev index 70a5a98..d4a9f1b 100755 --- a/ynh-dev +++ b/ynh-dev @@ -92,8 +92,7 @@ elif [ "$1" = "create-env" ]; then # Get YunoHost dev tools git clone -b opi-boxes https://github.com/YunoHost/ynh-dev ynh-dev-tools - cp ynh-dev-tools/ynh-dev ynh-dev - # cp $pwd/$0 ./$0 + ln -s ynh-dev-tools/ynh-dev ynh-dev ################################# From 7f4a092a5ced3c8f83251f52380d47e372bdec89 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:28:05 +0200 Subject: [PATCH 13/26] Last commit introduce vagrant error: 'Too many levels of symbolic links'. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index d4a9f1b..8cce5d1 100755 --- a/ynh-dev +++ b/ynh-dev @@ -92,7 +92,7 @@ elif [ "$1" = "create-env" ]; then # Get YunoHost dev tools git clone -b opi-boxes https://github.com/YunoHost/ynh-dev ynh-dev-tools - ln -s ynh-dev-tools/ynh-dev ynh-dev + cp ynh-dev-tools/ynh-dev ynh-dev ################################# From 6b0492ecf1996a922901dc740e8a4059d9d999f2 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:28:18 +0200 Subject: [PATCH 14/26] Add self-update command. --- ynh-dev | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ynh-dev b/ynh-dev index 8cce5d1..93aed7e 100755 --- a/ynh-dev +++ b/ynh-dev @@ -23,6 +23,8 @@ Usage : Deploy sources to test it `basename $0` watch [PACKAGES [PACKAGES ...]] Deploy sources each time there is change + `basename $0` self-update + Update this script (`basename $0`) PACKAGES : moulinette @@ -288,6 +290,10 @@ elif [ "$1" = "watch" ]; then done +elif [ "$1" = "self-update" ]; then + check_yunohost_vm + cd /vagrant/ynh-dev-tools && git pull && cp ynh-dev ../ynh-dev + # Fallback to print usage else usage From c17ac2a54aa9a9efdd13ca92778863f00681d59a Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 13:40:20 +0200 Subject: [PATCH 15/26] Use only lowercase repo name --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index 93aed7e..eaa434b 100755 --- a/ynh-dev +++ b/ynh-dev @@ -83,7 +83,7 @@ elif [ "$1" = "create-env" ]; then mkdir -p backup # Get YunoHost packages - git clone -b unstable https://github.com/Kloadut/SSOwat SSOwat + git clone -b unstable https://github.com/Kloadut/SSOwat ssowat git clone -b unstable https://github.com/YunoHost/yunohost-admin yunohost-admin git clone -b unstable https://github.com/YunoHost/yunohost yunohost git clone -b unstable https://github.com/YunoHost/moulinette moulinette From e117a2c0d0ac95de6e03540bd4c49816225b5383 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 15:58:20 +0200 Subject: [PATCH 16/26] Hardcode box url and download them for vargant<1.5 version. --- ynh-dev | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/ynh-dev b/ynh-dev index eaa434b..8f475fe 100755 --- a/ynh-dev +++ b/ynh-dev @@ -108,20 +108,42 @@ elif [ "$1" = "run" ]; then VERSION=$3 fi - if [ "$VERSION" = "stable" ]; then - IP="192.168.33.80" - elif [ "$VERSION" = "testing" ]; then - IP="192.168.33.81" - elif [ "$VERSION" = "unstable" ]; then - IP="192.168.33.82" - fi - echo "Creating $DOMAIN virtual machine with YunoHost $VERSION version" echo "" + + # Get vagrant box info from version + if [ "$VERSION" = "stable" ]; then + BOX_NAME="opi/yunohost-stable" + BOX_URL="http://build.yunohost.org/yunohost-stable8-builded.box" + IP="192.168.33.80" + elif [ "$VERSION" = "testing" ]; then + BOX_NAME="opi/yunohost-testing" + BOX_URL="http://build.yunohost.org/yunohost-testing8-builded.box" + IP="192.168.33.81" + elif [ "$VERSION" = "unstable" ]; then + BOX_NAME="opi/yunohost-unstable" + BOX_URL="http://build.yunohost.org/yunohost-unstable8-builded.box" + IP="192.168.33.82" + else + echo "ERROR: Incorrect version '$VERSION'. See '$(basename $0) --help' for usage." + exit 102 + fi + + # Download box if not available + if ! vagrant box list | grep -qc $BOX_NAME ; then + echo "Vagrant box '$BOX_NAME' is missing. Trying to download it" + vagrant box add $BOX_NAME $BOX_URL --provider virtualbox + echo "" + fi + + # Run VM + vagrant up $VERSION + + # Warn user about hosts file echo "/!\ Please add '$IP $DOMAIN' to your /etc/hosts file /!\\" echo "" - vagrant up $VERSION + # Log into the VM vagrant ssh $VERSION From d7ae31ccf4c53d26eb865e6f1d6f42d595277ccb Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 27 Apr 2016 18:23:41 +0200 Subject: [PATCH 17/26] Fix wrong folder name in yunohost use-git command. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index 8f475fe..a023161 100755 --- a/ynh-dev +++ b/ynh-dev @@ -224,7 +224,7 @@ elif [ "$1" = "use-git" ]; then if [ ! -L '/usr/share/yunohost/helpers.d' ]; then sudo rm -rf /usr/share/yunohost/helpers.d; fi sudo ln -s -f /vagrant/yunohost/data/helpers.d /usr/share/yunohost/helpers.d if [ ! -L '/usr/share/yunohost/yunohost-config/moulinette' ]; then sudo rm -rf /usr/share/yunohost/yunohost-config/moulinette; fi - sudo ln -s -f /vagrant/yunohost/data/others /usr/share/yunohost/yunohost-config/moulinette + sudo ln -s -f /vagrant/yunohost/data/other /usr/share/yunohost/yunohost-config/moulinette # debian if [ ! -L '/usr/share/pam-configs/mkhomedir' ]; then sudo rm /usr/share/pam-configs/mkhomedir; fi From 211fbc931e09092a1728a2b5d1594188fbe2bc43 Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 28 Apr 2016 15:20:15 +0200 Subject: [PATCH 18/26] [fix] remove useless Fedora dependency and add virtualbox provider when running Vagrant. --- README.md | 2 +- ynh-dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbfa280..7dd867f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Install dependencies # Debian, Ubuntu, Mint sudo apt-get install vagrant # Fedora -sudo dnf install vagrant vagrant-libvirt +sudo dnf install vagrant ``` Next download ynh-dev script diff --git a/ynh-dev b/ynh-dev index a023161..d1a9fc3 100755 --- a/ynh-dev +++ b/ynh-dev @@ -137,7 +137,7 @@ elif [ "$1" = "run" ]; then fi # Run VM - vagrant up $VERSION + vagrant up $VERSION --provider virtualbox # Warn user about hosts file echo "/!\ Please add '$IP $DOMAIN' to your /etc/hosts file /!\\" From 45f4f55781e5d1b50e34822701f6d3b60321c39f Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 29 Apr 2016 13:23:31 +0200 Subject: [PATCH 19/26] [enh] Remove net-tools dependency and get proper VM IP. --- ynh-dev | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ynh-dev b/ynh-dev index d1a9fc3..6df8d34 100755 --- a/ynh-dev +++ b/ynh-dev @@ -162,7 +162,7 @@ elif [ "$1" = "upgrade" ]; then sudo apt-get update sudo apt-get -y upgrade sudo apt-get -y dist-upgrade - sudo apt-get install -y inotify-tools net-tools + sudo apt-get install -y inotify-tools ####################### @@ -170,10 +170,8 @@ elif [ "$1" = "upgrade" ]; then ####################### elif [ "$1" = "ip" ]; then check_yunohost_vm - # TODO : check for installed paquage instead of quiet install - sudo apt-get install -qq -y net-tools # Print IP - ip=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') + ip=$(/bin/ip a | grep 'inet 192.168' | awk -F " " '{print $2}' | awk -F "/" '{print $1}') echo "IP: $ip" From e0c7acb75e87bc3c7a481ced2c151f1e475758bd Mon Sep 17 00:00:00 2001 From: opi Date: Tue, 3 May 2016 14:30:52 +0200 Subject: [PATCH 20/26] [enh] Add info about postinstall. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7dd867f..ab259ce 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,13 @@ cd /path/to/dev/env ynh-dev run ynh.local testing ``` +You'll be automatically logged in the VM through ssh. + +You probably wan't to run the postinstall now: +```bash +(sudo) yunohost tools postinstall +``` + ## Inside the Virtual machine (VM) Once logged into your VM, go to `/vagrant` to enjoy folder sharing, and take From 707162eb7946ed01ff64fe398175f20048bb6ede Mon Sep 17 00:00:00 2001 From: opi Date: Tue, 3 May 2016 14:32:53 +0200 Subject: [PATCH 21/26] [fix] Use vanilla markdown. --- README.md | 51 ++++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index ab259ce..7b6e589 100644 --- a/README.md +++ b/README.md @@ -28,22 +28,20 @@ helper to run a Vagrant virtual machine in the right place. ### Create the environment -```shell -ynh-dev create-env /path/to/dev/env -``` + ynh-dev create-env /path/to/dev/env + ### Run a container -``` -cd /path/to/dev/env -ynh-dev run ynh.local testing -``` + + cd /path/to/dev/env + ynh-dev run ynh.local testing You'll be automatically logged in the VM through ssh. You probably wan't to run the postinstall now: -```bash -(sudo) yunohost tools postinstall -``` + + (sudo) yunohost tools postinstall + ## Inside the Virtual machine (VM) @@ -53,42 +51,37 @@ advantages of the `ynh-dev` script. ### Upgrade the container It will update every debian packages. -``` -/vagrant/ynh-dev upgrade -``` + + /vagrant/ynh-dev upgrade ### Use Git repositories When doing `create-env` command, every YunoHost package have been cloned in the corresponding path. Use these Git repositories inside the VM (with symlink). Your changes will be available immediatly in your VM. -``` -/vagrant/ynh-dev use-git -``` + + /vagrant/ynh-dev use-git ***Note***: These changes can be reverted now. Alternatively you can use Git only for one packages (ssowat, yunohost, moulinette, yunohost-admin) -``` -/vagrant/ynh-dev use-git PACKAGE_NAME -``` + + /vagrant/ynh-dev use-git PACKAGE_NAME + ### Deploy your change -``` -/vagrant/ynh-dev deploy -``` + + /vagrant/ynh-dev deploy ### Deploy your change in realtime (each time you saved source code) -``` -/vagrant/ynh-dev watch -``` + + /vagrant/ynh-dev watch ### Get ip address of your vm -``` -/vagrant/ynh-dev ip -``` + + /vagrant/ynh-dev ip ## More info -https://yunohost.org/#/dev_fr (french) +[yunohost.org/dev_fr](https://yunohost.org/dev_fr) (in french) From e08c05776df1bf52781bed2ec9ebc00c0012bc5a Mon Sep 17 00:00:00 2001 From: opi Date: Tue, 3 May 2016 14:36:13 +0200 Subject: [PATCH 22/26] [fix] Remove old deploy & watch commands. --- README.md | 16 +++++++--------- ynh-dev | 47 ----------------------------------------------- 2 files changed, 7 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 7b6e589..f432bf3 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ advantages of the `ynh-dev` script. ### Upgrade the container -It will update every debian packages. +It will update every debian packages, including YunoHost ones. /vagrant/ynh-dev upgrade @@ -70,18 +70,16 @@ moulinette, yunohost-admin) /vagrant/ynh-dev use-git PACKAGE_NAME -### Deploy your change - - /vagrant/ynh-dev deploy - -### Deploy your change in realtime (each time you saved source code) - - /vagrant/ynh-dev watch - ### Get ip address of your vm /vagrant/ynh-dev ip + +### Update `ynh-dev` script + + /vagrant/ynh-dev self-update + + ## More info [yunohost.org/dev_fr](https://yunohost.org/dev_fr) (in french) diff --git a/ynh-dev b/ynh-dev index 6df8d34..2015cf8 100755 --- a/ynh-dev +++ b/ynh-dev @@ -19,10 +19,6 @@ Usage : Upgrade the container `basename $0` use-git [PACKAGES [PACKAGES ...]] Use Git repositories from dev environment path - `basename $0` deploy [PACKAGES [PACKAGES ...]] - Deploy sources to test it - `basename $0` watch [PACKAGES [PACKAGES ...]] - Deploy sources each time there is change `basename $0` self-update Update this script (`basename $0`) @@ -162,7 +158,6 @@ elif [ "$1" = "upgrade" ]; then sudo apt-get update sudo apt-get -y upgrade sudo apt-get -y dist-upgrade - sudo apt-get install -y inotify-tools ####################### @@ -267,48 +262,6 @@ elif [ "$1" = "use-git" ]; then esac done -elif [ "$1" = "deploy" ]; then - check_yunohost_vm - for i in ${!packages[@]}; do - case ${packages[i]} in - moulinette) - # Install moulinette - cd $BASE_DIR/moulinette - ./setup.py install - cd .. - [ -e "./cache/moulinette/actionsmap/yunohost.pkl" ] && rm /var/cache/moulinette/actionsmap/yunohost.pkl - echo "moulinette deployed" - ;; - ssowat) - # Install ssowat - sed "s@^@cp -Rf $BASE_DIR/SSOwat/@" $BASE_DIR/SSOwat/debian/install | source /dev/stdin - service nginx stop || true - service nginx start || echo 'Fail to restart nginx' - echo "ssowat deployed" - ;; - yunohost) - # Install yunohost - cat $BASE_DIR/yunohost/debian/install | awk '{print "mkdir -p " $2}' | source /dev/stdin - sed "s@^@cp -Rf $BASE_DIR/yunohost/@" $BASE_DIR/yunohost/debian/install | source /dev/stdin - service yunohost-api restart || echo 'Fail to restart yunohost-api' - echo "yunohost deployed" - ;; - yunohost-admin) - # Install yunohost-admin - sed "s@^@cp -Rf $BASE_DIR/yunohost-admin/@" $BASE_DIR/yunohost-admin/debian/install | source /dev/stdin - echo "yunohost-admin deployed" - ;; - esac - done - - -elif [ "$1" = "watch" ]; then - check_yunohost_vm - sudo apt-get install -y inotify-tools - while inotifywait -r -e close_write $BASE_DIR/moulinette/ $BASE_DIR/SSOwat/ $BASE_DIR/yunohost/ $BASE_DIR/yunohost-admin/; do - $BASE_DIR/$0 deploy ${@:2}; - done - elif [ "$1" = "self-update" ]; then check_yunohost_vm From eb9ff588163990d9cf4293fcc7ff8fd3bc77ba7c Mon Sep 17 00:00:00 2001 From: opi Date: Tue, 3 May 2016 16:13:39 +0200 Subject: [PATCH 23/26] [fix] Locales symlink after yunohost source symlink. --- ynh-dev | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ynh-dev b/ynh-dev index 2015cf8..f8ebd1f 100755 --- a/ynh-dev +++ b/ynh-dev @@ -235,14 +235,14 @@ elif [ "$1" = "use-git" ]; then if [ ! -L '/usr/lib/metronome/modules/vcard.lib.lua' ]; then sudo rm /usr/lib/metronome/modules/vcard.lib.lua; fi sudo ln -s -f /vagrant/yunohost/lib/metronome/modules/vcard.lib.lua /usr/lib/metronome/modules/vcard.lib.lua - # locales - if [ ! -L '/usr/lib/moulinette/yunohost/locales' ]; then sudo rm -rf /usr/lib/moulinette/yunohost/locales; fi - sudo ln -s -f /vagrant/yunohost/locales /usr/lib/moulinette/yunohost/locales - # src if [ ! -L '/usr/lib/moulinette/yunohost' ]; then sudo rm -rf /usr/lib/moulinette/yunohost; fi sudo ln -s -f /vagrant/yunohost/src/yunohost /usr/lib/moulinette/yunohost + # locales + if [ ! -L '/usr/lib/moulinette/yunohost/locales' ]; then sudo rm -rf /usr/lib/moulinette/yunohost/locales; fi + sudo ln -s -f /vagrant/yunohost/locales /usr/lib/moulinette/yunohost/locales + # Remove actionsmap cache [ -e '/var/cache/moulinette/actionsmap/yunohost.pkl' ] && sudo rm /var/cache/moulinette/actionsmap/yunohost.pkl echo "↳ Don't forget to remove '/var/cache/moulinette/actionsmap/yunohost.pkl' cache when hacking yunohost" From 6b0a43c9bd8b479a12937fcefe9a3cbb2b418935 Mon Sep 17 00:00:00 2001 From: opi Date: Wed, 4 May 2016 14:02:01 +0200 Subject: [PATCH 24/26] [enh] Document postinstall --domain option. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f432bf3..45c13b5 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ You'll be automatically logged in the VM through ssh. You probably wan't to run the postinstall now: - (sudo) yunohost tools postinstall + (sudo) yunohost tools postinstall -d ynh.local ## Inside the Virtual machine (VM) From 03bc8b9add80b729793a5f35110ad95738467947 Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 19:44:44 +0200 Subject: [PATCH 25/26] [fix] SSOwat has moved. --- ynh-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ynh-dev b/ynh-dev index f8ebd1f..966e7c2 100755 --- a/ynh-dev +++ b/ynh-dev @@ -79,7 +79,7 @@ elif [ "$1" = "create-env" ]; then mkdir -p backup # Get YunoHost packages - git clone -b unstable https://github.com/Kloadut/SSOwat ssowat + git clone -b unstable https://github.com/YunoHost/SSOwat ssowat git clone -b unstable https://github.com/YunoHost/yunohost-admin yunohost-admin git clone -b unstable https://github.com/YunoHost/yunohost yunohost git clone -b unstable https://github.com/YunoHost/moulinette moulinette From 52ed0e7dcf178eae7e8c4fabf8f50d448ed02a83 Mon Sep 17 00:00:00 2001 From: zamentur Date: Sat, 7 May 2016 10:55:05 +0200 Subject: [PATCH 26/26] [enh] Install gulp and run it if needed --- ynh-dev | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ynh-dev b/ynh-dev index 966e7c2..38c8072 100755 --- a/ynh-dev +++ b/ynh-dev @@ -249,6 +249,21 @@ elif [ "$1" = "use-git" ]; then echo "" ;; yunohost-admin) + + # Install npm dependencies if needed + which gulp > /dev/null + if [ $? -eq 1 ] + then + sudo apt-get -y install nodejs-legacy npm + cd /vagrant/yunohost-admin/src + sudo npm install + sudo npm install -g bower + sudo npm install -g gulp + fi + cd /vagrant/yunohost-admin/src + sudo su -c "bower install" vagrant + sudo su -c "gulp build --dev" vagrant + echo "Using Git repository for yunohost-admin" # Remove current sources if not a symlink if [ ! -L '/usr/share/yunohost/admin' ]; then @@ -256,8 +271,9 @@ elif [ "$1" = "use-git" ]; then fi # Symlink from Git repository sudo ln -s -f /vagrant/yunohost-admin/src /usr/share/yunohost/admin - echo "↳ Don't forget to do build admin with Gulp when hacking yunohost-admin. See README file" - echo "" + + sudo su -c "gulp watch --dev" vagrant + ;; esac done