From 7f656042500352d584c713e2a3edacdb5d34f1e6 Mon Sep 17 00:00:00 2001
From: hwdsl2 <hwdsl2@users.noreply.github.com>
Date: Thu, 10 May 2018 02:57:08 -0500
Subject: [PATCH] Update Azure template

- Use Debian 9 instead of Debian 8
- Update Virtual Machine size options
- Add wait for apt/dpkg lock in install.sh
---
 azure/README-zh.md     |  6 +++---
 azure/README.md        |  6 +++---
 azure/azuredeploy.json | 33 ++++++++++-----------------------
 azure/install.sh       |  3 +++
 4 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/azure/README-zh.md b/azure/README-zh.md
index dd23efe..8cc7d0e 100644
--- a/azure/README-zh.md
+++ b/azure/README-zh.md
@@ -9,8 +9,8 @@
  - Username for VPN and SSH (用户名)
  - Password for VPN and SSH (密码)
  - IPsec Pre-Shared Key for VPN (IPsec 预共享密钥)
- - Operating System Image (操作系统镜像,Debian 8 或 Ubuntu 16.04 LTS)
- - Virtual Machine Size (虚拟机大小,默认值: Basic_A0)
+ - Operating System Image (操作系统镜像,Debian 9 或 Ubuntu 16.04 LTS)
+ - Virtual Machine Size (虚拟机大小,默认值: Standard_B1s)
 
 请单击以下按钮开始:
 
@@ -23,7 +23,7 @@
 ## 作者
 
 版权所有 (C) 2016 [Daniel Falkner](https://github.com/derdanu)   
-版权所有 (C) 2017 Lin Song
+版权所有 (C) 2017-2018 Lin Song
 
 ## 屏幕截图
 
diff --git a/azure/README.md b/azure/README.md
index f9efc7e..220589a 100644
--- a/azure/README.md
+++ b/azure/README.md
@@ -9,8 +9,8 @@ Customizable with the following options:
  - Username for VPN and SSH
  - Password for VPN and SSH
  - IPsec Pre-Shared Key for VPN
- - Operating System Image (Debian 8 or Ubuntu 16.04 LTS)
- - Virtual Machine Size (Default: Basic_A0)
+ - Operating System Image (Debian 9 or Ubuntu 16.04 LTS)
+ - Virtual Machine Size (Default: Standard_B1s)
 
 Press this button to start:
 
@@ -23,7 +23,7 @@ When the deployment finishes, Azure displays a notification. Next steps: [Config
 ## Authors
 
 Copyright (C) 2016 [Daniel Falkner](https://github.com/derdanu)   
-Copyright (C) 2017 Lin Song
+Copyright (C) 2017-2018 Lin Song
 
 ## Screenshot
 
diff --git a/azure/azuredeploy.json b/azure/azuredeploy.json
index b330df6..2f67031 100644
--- a/azure/azuredeploy.json
+++ b/azure/azuredeploy.json
@@ -25,34 +25,21 @@
       "type": "string",
       "allowedValues": [
         "ubuntu1604",
-        "debian8"
+        "debian9"
       ],
-      "defaultValue": "debian8",
+      "defaultValue": "debian9",
       "metadata": {
-        "description": "OS to use. Debian 8 or Ubuntu 16.04 LTS"
+        "description": "OS to use. Debian 9 or Ubuntu 16.04 LTS"
       }
     },
     "VMSize": {
       "type": "string",
-      "defaultValue": "Basic_A0",
+      "defaultValue": "Standard_B1s",
       "allowedValues": [
-        "Basic_A0",
-        "Basic_A1",
-        "Basic_A2",
-        "Basic_A3",
-        "Basic_A4",
-        "Standard_A0",
-        "Standard_A1",
-        "Standard_A2",
-        "Standard_A3",
-        "Standard_A4",
-        "Standard_A5",
-        "Standard_A6",
-        "Standard_A7",
-        "Standard_D1",
-        "Standard_D2",
-        "Standard_D3",
-        "Standard_D4"
+        "Standard_B1s",
+        "Standard_B1ms",
+        "Standard_B2s",
+        "Standard_B2ms"
       ],
       "metadata": {
         "description": "The size of the Virtual Machine."
@@ -77,10 +64,10 @@
       "sku": "16.04-LTS",
       "version": "latest"
     },
-    "debian8": {
+    "debian9": {
       "publisher": "credativ",
       "offer": "Debian",
-      "sku": "8",
+      "sku": "9",
       "version": "latest"
     },
     "installScriptURL": "https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/azure/install.sh",
diff --git a/azure/install.sh b/azure/install.sh
index 4174f5f..811f7c3 100644
--- a/azure/install.sh
+++ b/azure/install.sh
@@ -4,4 +4,7 @@ export VPN_IPSEC_PSK=$1
 export VPN_USER=$2
 export VPN_PASSWORD=$3
 
+# Wait 60 seconds for apt/dpkg lock
+sleep 60
+
 wget https://git.io/vpnsetup -O vpnsetup.sh && sh vpnsetup.sh