]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Scripts] Introduce FSGET - a simple way to install FreeSWITCH. 2667/head
authorAndrey Volk <andywolk@gmail.com>
Fri, 10 May 2024 16:41:40 +0000 (19:41 +0300)
committerAndrey Volk <andywolk@gmail.com>
Sun, 15 Dec 2024 11:15:02 +0000 (14:15 +0300)
README.md
scripts/packaging/README.md [new file with mode: 0644]
scripts/packaging/fsget.sh [new file with mode: 0755]

index 728486f8910d66b40a865b666675aef8a078521f..e8412857d605b1fb1d4104a6e8ff1b785ab31597 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,7 +33,8 @@ The main index for documentation is available at:
 
 Step by step tutorials to install FreeSWITCH from packages:
 
-  * [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian) [<b>Recommended</b>]
+  * [Using FSGET](/scripts/packaging) [<b>Recommended</b>]
+  * [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian)
   * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi)
   * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7)
 
diff --git a/scripts/packaging/README.md b/scripts/packaging/README.md
new file mode 100644 (file)
index 0000000..8805932
--- /dev/null
@@ -0,0 +1,40 @@
+# Installing FreeSWITCH using FSGET\r
+\r
+## Prerequisites\r
+\r
+### Dependencies\r
+Make sure you have `cURL` binary installed or use any other downloader.\r
+To install curl type\r
+```\r
+apt update && apt install -y curl\r
+```\r
+\r
+### Authentication required\r
+\r
+A `SignalWire Personal Access Token` (PAT) or an `API Token` (for enterprise customers) is required to access FreeSWITCH install packages.\r
+\r
+[HOWTO Create a SignalWire Personal Access Token](https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/how-to-create-a-personal-access-token/how-to-create-a-personal-access-token)\r
+\r
+[Upgrade to FreeSWITCH Advantage](https://signalwire.com/products/freeswitch-enterprise)\r
+\r
+## Configuring FreeSWITCH Debian repository\r
+```\r
+curl -sSL https://freeswitch.org/fsget | bash -s <PAT or API token> [release|prerelease] [install]\r
+```\r
+\r
+Notice that `fsget` accepts arguments:\r
+- `<PAT or FSA token>` (Required)\r
+- `[release|prerelease]` (Optional) - `release` by default, `prerelease` is what you see in the `master` branch\r
+- `[install]` (Optional) - If missing it will not install FreeSWITCH automatically after configuring the repository\r
+\r
+`FreeSWITCH Community` or `FreeSWITCH Enterprise` version is installed based on the token provided.\r
+\r
+Enterprise customers may install `FreeSWITCH Community` versions by using a `SignalWire Personal Access Token` instead of an `API Token`.\r
+## Installing FreeSWITCH\r
+If not installed already type\r
+\r
+```\r
+apt-get install -y freeswitch-meta-all\r
+```\r
+\r
+Enjoy using FreeSWITCH!
\ No newline at end of file
diff --git a/scripts/packaging/fsget.sh b/scripts/packaging/fsget.sh
new file mode 100755 (executable)
index 0000000..bb5e005
--- /dev/null
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+TOKEN=$1
+RELEASE=$2
+INSTALL=$3
+
+# Source the os-release file (assuming it exists)
+. /etc/os-release
+echo $ID
+echo $VERSION_CODENAME
+
+if [ "${ID,,}" = "debian" ]; then
+       ARCH=$(dpkg --print-architecture)
+       if [[ "${TOKEN}" == pat_* ]]; then
+               echo "FreeSWITCH Community"
+
+               RPI=""
+
+               if [ "${RELEASE,,}" = "prerelease" ]; then
+                       RELEASE="unstable"
+               else
+                       RELEASE="release"
+               fi
+
+               echo $RELEASE
+
+               if [ "${ARCH,,}" = "armhf" ]; then
+                       RPI="rpi/"
+               fi
+
+               rm -f /etc/apt/sources.list.d/freeswitch.list
+               apt-get update && apt-get install -y gnupg2 wget software-properties-common apt-transport-https
+
+               wget --http-user=signalwire --http-password=$TOKEN -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg
+               echo "machine freeswitch.signalwire.com login signalwire password $TOKEN" > /etc/apt/auth.conf
+               chmod 600 /etc/apt/auth.conf
+               echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/freeswitch.list
+               echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" >> /etc/apt/sources.list.d/freeswitch.list
+
+               apt-get update
+               if [ "${INSTALL}" = "install" ]; then
+                       echo "Installing FreeSWITCH Community"
+                       apt-get install -y freeswitch-meta-all
+                       echo "------------------------------------------------------------------"
+                       echo " Done installing FreeSWITCH Community"
+                       echo "------------------------------------------------------------------"
+               else
+                       echo "------------------------------------------------------------------"
+                       echo " Done configuring FreeSWITCH Debian repository"
+                       echo "------------------------------------------------------------------"
+                       echo "To install FreeSWITCH Community type: apt-get install -y freeswitch-meta-all"
+               fi
+       elif [[ "${TOKEN}" == PT* ]]; then
+               echo "FreeSWITCH Enterprise"
+
+               if [ "${RELEASE,,}" = "prerelease" ]; then
+                       RELEASE="unstable"
+               else
+                       RELEASE="1.8"
+               fi
+
+               echo $RELEASE
+
+               if [ "${ARCH,,}" = "armhf" ]; then
+                       RPI="-rpi"
+               fi
+
+               rm -f /etc/apt/sources.list.d/freeswitch.list
+               apt-get update && apt-get install -y gnupg2 wget software-properties-common apt-transport-https
+
+               wget --http-user=signalwire --http-password=$TOKEN -O - https://fsa.freeswitch.com/repo/deb/fsa${RPI}/pubkey.gpg | apt-key add -
+               echo "machine fsa.freeswitch.com login signalwire password $TOKEN" > /etc/apt/auth.conf
+               chmod 600 /etc/apt/auth.conf
+               echo "deb https://fsa.freeswitch.com/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" > /etc/apt/sources.list.d/freeswitch.list
+               echo "deb-src https://fsa.freeswitch.com/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" >> /etc/apt/sources.list.d/freeswitch.list
+
+               apt-get update
+               if [ "${INSTALL}" = "install" ]; then
+                       echo "Installing FreeSWITCH Enterprise"
+                       apt-get install -y freeswitch-meta-all
+                       echo "------------------------------------------------------------------"
+                       echo " Done installing FreeSWITCH Enterprise"
+                       echo "------------------------------------------------------------------"
+               else
+                       echo "------------------------------------------------------------------"
+                       echo " Done configuring FreeSWITCH Debian repository"
+                       echo "------------------------------------------------------------------"
+                       echo "To install FreeSWITCH Enterprise type: apt-get install -y freeswitch-meta-all"
+               fi
+       else
+               echo "Unrecognized token type"
+       fi
+else
+       echo "Unrecognized OS. We support Debian only."
+fi
\ No newline at end of file