10 Commits

Author SHA1 Message Date
agentcobra
9e82f4776c Merge branch 'master' into develop 2018-09-10 20:27:16 +02:00
pitchum
aa7bbd6a4c [mod] Created file check_process for driving CI builds. 2018-08-29 10:40:12 +02:00
pitchum
7800953960 [fix] upgrade script requires some helpers.
```
Warning: Upgrading app vpnclient...
Warning: ./upgrade: line 35: ynh_abort_if_up_to_date: command not found
Warning: !!
Warning:   vpnclient's script has encountered an error. Its execution was cancelled.
Warning: !!
Warning:
Error: Unable to upgrade vpnclient
```
2018-08-25 19:24:31 +02:00
ljf (zamentur)
1fc4581106 [fix] Sync the date with http if ntp can't (#37)
* [fix] Sync the date with http if ntp can't
2018-06-13 11:30:43 +02:00
ljf (zamentur)
081447008c [fix] Let VPN mount (#38) 2018-05-22 09:43:35 +02:00
Bastien
24ff5a8687 travis improvement
with manifest check JSON
2018-05-13 12:33:59 +02:00
agentcobra
a55574ac9b Update README.md
add integration from jenkins
2018-05-13 11:48:07 +02:00
Sebastien Badia
9c736b4804 doc: s/NextCloud/LaBriqueInterNet VPNclient/ thx agentcorba 2018-05-13 11:38:27 +02:00
Sebastien Badia
3efa16e19e doc: Update syntax (badges) 2018-05-13 11:25:37 +02:00
Sebastien Badia
c4d2bab59c doc: Added install badge 2018-05-13 11:22:56 +02:00
5 changed files with 136 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
language: php language: python
before_script: before_script:
- git clone --depth 1 git://github.com/YunoHost/package_linter ../package_linter && cd ../package_linter - git clone --depth 1 git://github.com/YunoHost/package_linter ../package_linter && cd ../package_linter
- mv ../vpnclient_ynh vpnclient_ynh - mv ../vpnclient_ynh vpnclient_ynh
script: script:
- python -m json.tool vpnclient_ynh/manifest.json
- ./package_linter.py vpnclient_ynh - ./package_linter.py vpnclient_ynh
notifications: notifications:
email: false email: false

View File

@@ -1,5 +1,6 @@
# VPN Client # VPN Client [![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Integration level](https://dash.yunohost.org/integration/vpnclient.svg)](https://ci-apps.yunohost.org/jenkins/job/vpnclient%20%28Community%29/lastBuild/consoleFull)
[![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Install LaBriqueInterNet VPNclient with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=vpnclient)
## Overview ## Overview
VPN Client app for [YunoHost](http://yunohost.org/). VPN Client app for [YunoHost](http://yunohost.org/).

40
check_process Normal file
View File

@@ -0,0 +1,40 @@
;; Test complet
; pre-install
echo -n "Si j'avais des commandes à exécuter ce serait ici "
; Manifest
domain="domain.tld" (DOMAIN)
path="/vpnconfig" (PATH)
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=0
setup_nourl=0
setup_private=1
setup_public=0
upgrade=1
upgrade=1 from_commit=355b24ea0cd3467d7ba1390ab7d34dd4b2500229
upgrade=1 from_commit=1fc458110660ce775f7613091cde3c5fdcfbe4e6
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
Level 4=0
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=pitchum@gramaton.org
Notification=down
#;;; Upgrade options
# ; commit=65c382d138596fcb32b4c97c39398815a1dcd4e8
# name=Name of this previous version
# manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&
#

View File

@@ -129,6 +129,10 @@ start_openvpn() {
[ "${ynh_server_proto}" == tcp ] && proto=tcp-client [ "${ynh_server_proto}" == tcp ] && proto=tcp-client
fi fi
# Unset firewall to let DNS and NTP resolution works
# Firewall is reset after vpn is mounted (more details on #1016)
unset_firewall
sync_time sync_time
cp /etc/openvpn/client.conf{.tpl,} cp /etc/openvpn/client.conf{.tpl,}
@@ -200,6 +204,20 @@ stop_openvpn() {
sync_time() { sync_time() {
systemctl stop ntp systemctl stop ntp
timeout 20 ntpd -qg &> /dev/null timeout 20 ntpd -qg &> /dev/null
# Some networks drop ntp port (udp 123).
# Try to get the date with an http request on the internetcube web site
if [ $? -ne 0 ]; then
http_date=`curl -sD - labriqueinter.net | grep '^Date:' | cut -d' ' -f3-6`
http_date_seconds=`date -d "${http_date}" +%s`
curr_date_seconds=`date +%s`
# Set the new date if it's greater than the current date
# So it does if 1970 year or if old fake-hwclock date is used
if [ $http_date_seconds -ge $curr_date_seconds ]; then
date -s "${http_date}"
fi
fi
systemctl start ntp systemctl start ntp
} }

View File

@@ -41,3 +41,76 @@ function ynh_systemctl()
mv $LOCKFILE.bkp.$$ $LOCKFILE mv $LOCKFILE.bkp.$$ $LOCKFILE
} }
# Read the value of a key in a ynh manifest file
#
# usage: ynh_read_manifest manifest key
# | arg: manifest - Path of the manifest to read
# | arg: key - Name of the key to find
ynh_read_manifest () {
manifest="$1"
key="$2"
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
}
# Read the upstream version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number before ~ynh
# In the last example it return 4.3-2
#
# usage: ynh_app_upstream_version
ynh_app_upstream_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest "$manifest_path" "version")
echo "${version_key/~ynh*/}"
}
# Read package version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number after ~ynh
# In the last example it return 3
#
# usage: ynh_app_package_version
ynh_app_package_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest "$manifest_path" "version")
echo "${version_key/*~ynh/}"
}
# Exit without error if the package is up to date
#
# This helper should be used to avoid an upgrade of a package
# when it's not needed.
#
# To force an upgrade, even if the package is up to date,
# you have to set the variable YNH_FORCE_UPGRADE before.
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
#
# usage: ynh_abort_if_up_to_date
ynh_abort_if_up_to_date () {
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
local package_check=${PACKAGE_CHECK_EXEC:-0}
local version=$(ynh_read_manifest "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
local last_version=$(ynh_read_manifest "../manifest.json" "version" || echo 1.0)
if [ "$version" = "$last_version" ]
then
if [ "$force_upgrade" != "0" ]
then
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
unset YNH_FORCE_UPGRADE
elif [ "$package_check" != "0" ]
then
echo "Upgrade forced for package check." >&2
else
ynh_die "Up-to-date, nothing to do" 0
fi
fi
}