Skip to content

Commit

Permalink
Added updated readme and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
eizedev committed Apr 17, 2020
0 parents commit f4cdc8a
Show file tree
Hide file tree
Showing 13 changed files with 414 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
package.tgz
*.spk
LICENSE
/target
/dist
9 changes: 9 additions & 0 deletions INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package="AirConnect"
version=#VERSION#
description="Use AirPlay to stream to UPnP/Sonos & Chromecast devices"
maintainer="philippe44"
maintainer_url="https://github.com/philippe44/AirConnect"
distributor="eizedev"
distributor_url="https://github.com/eizedev/AirConnect-Synology"
arch="#INFO_ARCH#"
firmware="#INFO_FIRMWARE#"
87 changes: 87 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#Git commit SHA
REPO_REVISION=cb731dce032268ea93e5a7e6d5b3dc73c95b6c88
VERSION=0.2.24.7-$(shell date '+%Y%m%d')

LICENSE:
curl -s -L https://github.com/philippe44/AirConnect/raw/${REPO_REVISION}/LICENSE -O

target:
mkdir -p target

dist:
mkdir -p dist

target/package.tgz: target
$(if ${ARCH},,$(error Must specify ARCH))
curl -s -L https://github.com/philippe44/AirConnect/raw/${REPO_REVISION}/bin/airupnp-${ARCH} -o target/airupnp
chmod +x target/airupnp
curl -s -L https://github.com/philippe44/AirConnect/raw/${REPO_REVISION}/bin/aircast-${ARCH} -o target/aircast
chmod +x target/aircast
cd target && tar czf package.tgz airupnp aircast
rm target/airupnp target/aircast

target/scripts: target
cp -a scripts target

target/LICENSE: target
curl -s -L https://github.com/philippe44/AirConnect/raw/${REPO_REVISION}/LICENSE -o target/LICENSE

target/PACKAGE_ICON.PNG: target
cp PACKAGE_ICON.PNG target/PACKAGE_ICON.PNG

target/INFO: target
$(if ${INFO_ARCH},,$(error Must specify INFO_ARCH))
$(if ${INFO_FIRMWARE},,$(error Must specify INFO_FIRMWARE))
cp INFO target/INFO
sed -i.bak -e 's/#VERSION#/${VERSION}/' target/INFO
sed -i.bak -e 's/#INFO_ARCH#/${INFO_ARCH}/' target/INFO
sed -i.bak -e 's/#INFO_FIRMWARE#/${INFO_FIRMWARE}/' target/INFO
rm target/INFO.bak

dist/AirConnect-${ARCH}-${VERSION}.spk: target/package.tgz target/scripts target/LICENSE target/INFO target/PACKAGE_ICON.PNG dist
$(if ${ARCH},,$(error Must specify ARCH))
cd target && tar -czf AirConnect-${ARCH}-${VERSION}.spk *
mv target/AirConnect-${ARCH}-${VERSION}.spk dist/

.PHONY: arm
arm:
$(eval export INFO_ARCH=ipq806x armada370 armadaxp armada375 armada38x alpine alpine4k monaco comcerto2k)
$(eval export INFO_FIRMWARE=5.0-4458)
@true

.PHONY: aarch64
aarch64:
$(eval export INFO_ARCH=rtd1296)
$(eval export INFO_FIRMWARE=5.0-4458)
@true

.PHONY: x86
x86:
$(eval export INFO_ARCH=x86 cedarview bromolow evansport avoton braswell broadwell apollolake)
$(eval export INFO_FIRMWARE=5.0-4458)
@true

.PHONY: x86-64
x86-64:
$(eval export INFO_ARCH=x86_64)
$(eval export INFO_FIRMWARE=6.0-7321)
@true

.PHONY: build
build: ${ARCH} dist/AirConnect-${ARCH}-${VERSION}.spk

.PHONY: clean
clean:
rm -rf target

.PHONY: clean-dist
clean-dist:
rm -rf dist

.PHONY: build-all
build-all: clean-dist
./build.sh

.PHONY: shellcheck
shellcheck:
shellcheck -s sh scripts/*
Binary file added PACKAGE_ICON.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# AirConnect package for Synology NAS and Synology Router

[![Latest release](https://img.shields.io/github/release/eizedev/AirConnect-Synology.svg)](https://github.com/eizedev/AirConnect-Synology/releases/latest)

A minimal Synology package for [AirConnect](https://github.com/philippe44/AirConnect).
It allows you to use AirPlay to stream to UPnP/Sonos & Chromecast devices.

- [AirConnect package for Synology NAS and Synology Router](#airconnect-package-for-synology-nas-and-synology-router)
- [Information](#information)
- [How to install](#how-to-install)
- [Download the pre-built Synology package](#download-the-pre-built-synology-package)
- [Install via GUI (Package Center)](#install-via-gui-package-center)
- [Install via command line](#install-via-command-line)
- [How it works](#how-it-works)
- [Build](#build)
- [Run shellcheck (optional)](#run-shellcheck-optional)
- [Build packages for all architectures](#build-packages-for-all-architectures)
- [Build a package for a specific architecture](#build-a-package-for-a-specific-architecture)
- [Debugging](#debugging)
- [License](#license)

## Information

Since the [original repository](https://github.com/bandesz/AirConnect-Synology) from [@bandesz](https://github.com/bandesz) was archived, I will try to provide the latest releases here regularly and have updated the scripts and just provided the current release.
I own multiple Synology NAS Systems and the current Synology Router, as long as that is the case, I will also update the releases regularly.

If a release is missing, please open an [issue](https://github.com/eizedev/AirConnect-Synology/issues), then I will deliver it to.

The credit goes of course still to [@bandesz](https://github.com/bandesz) and [philippe44](https://github.com/philippe44).

## How to install

### Download the pre-built Synology package

You can find the available packages under [Releases](https://github.com/eizedev/AirConnect-Synology/releases) for four different architecture groups:

- **ARMv7**: ipq806x armada370 armadaxp armada375 armada38x alpine alpine4k monaco comcerto2k
- **ARMv8**: rtd1296
- **Intel - 32-bit**: x86 cedarview bromolow evansport avoton braswell broadwell apollolake
- **Intel - 64-bit (DSM 6.0+)**: x86_64

You can check which architecture you have [here](https://www.synology.com/en-us/knowledgebase/DSM/tutorial/Compatibility_Peripherals/What_kind_of_CPU_does_my_NAS_have).

For the Synology Routers you should use the ARM version.

### Install via GUI (Package Center)

Open the Package Center app.

As this package is not an official Synology package you may have to **allow packages from any publisher**. Go to **Settings** and set the **Trust Level** to "**Any publisher**".

Click on **Manual Install** and upload the package you just downloaded.

Don't forget to **change back** the **Trust level** to "Synology Inc." for additional security.

You can see the error logs by clicking on **View Log** on the package's page.

### Install via command line

- Connect to your NAS/Router via ssh
- Copy over or download your release for [your architecture](#download-the-pre-built-synology-package)
- Run the following command based on your architecture and version `sudo synopkg install AirConnect-${ARCH}-${VERSION}.spk`
- Example: `sudo synopkg install AirConnect-arm-0.2.24.7-20200417.spk`
- Start the **AirConnect** package with `/usr/syno/bin/synopkg start AirConnect` or trough the Package Center
- Check the status of AirConnect with `/usr/syno/bin/synopkg status AirConnect`
- You can find the logfile with `/usr/syno/bin/synopkg log AirConnect` (Default: `/tmp/airconnect.log`)

You could also clone this repository on your synology device and build your package for your distribution locally, check [Build](#build) for more details.

## How it works

It runs the AirConnect processes with the following options:

```bash
airupnp -b [router local ip]:49154 -z -l 1000:2000 -f /tmp/airupnp.log -d all=error -d main=info

aircast -b [router local ip] -z -l 1000:2000 -f /tmp/aircast.log -d all=error -d main=info
```

The process is running with a low-privilege user.

The processes will only recognise your devices if they are bound to the appropriate local network IP, but this is not trivial as there are various Synology devices and network setups.
The start script will check all your local network interfaces (with ip 192.168.* or 10.* or 172.16.* - 172.31.*) and checks if the airupnp/aircast processes add any devices (based on the logs).
It there are no devices added in 5 seconds it will try the next interface. For the automatic IP discovery to work you should have at least one UPnP/Sonos/Chromecast device on your network.

If the start script is not able to find the right IP automatically you can fix it in `scripts/start-stop-status` by setting your own local IP (of your nas/router) and building your own package.

Look for the following lines:

```bash
# If you want to start the airconnect processes on a specific IP please uncomment the following lines
# and set your own local IP address:
#
# start_airconnect_on_ip "1.2.3.4" || true
# return 0
```

Alternatively you can open an issue and include your network interface list and your local IP.

## Build

### Run shellcheck (optional)

```bash
make shellcheck
```

### Build packages for all architectures

```bash
make clean build-all
```

### Build a package for a specific architecture

```bash
ARCH=arm make clean build
```

Possible values for **ARCH**: `arm, aarch64, x86, x86-64`

You can find the built packages in the **dist** directory.

## Debugging

If you want to see more logs then change the `-d all=error` parameter in `scripts/start-stop-status` and rebuild the package, then [install it again](#install-via-command-line).

## License

See [LICENSE](https://github.com/philippe44/AirConnect/blob/master/LICENSE).
25 changes: 25 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

echo
echo "Build Start"

rm -r -f dist

set -euo pipefail

ARCH_LIST="arm aarch64 x86 x86-64"
MAKE=`which make`

for arch in ${ARCH_LIST}; do
export ARCH=${arch}
$MAKE clean build
done

rm -r -f target

echo
echo "Build complete, you can find the packages under the dist directory"

echo "how to install new package on synology x86 devices via commandline:"
echo "sudo synopkg install dist/AirConnect-x86-64-XXX.spk"
# sudo synopkg install dist/AirConnect-x86-64-${VERSION}.spk
15 changes: 15 additions & 0 deletions scripts/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Ensure user 'airconnect' exists before doing anything

if ! synouser --get airconnect > /dev/null 2>&1
then
# create user with random password
echo Creating AirConnect user.
synouser --add airconnect "$(uuidgen | cut -c-8)" 'AirConnect User' 0 '' ''
else
echo Securing existing AirConnect user
synouser --modify airconnect 'AirConnect User' 0 ''
fi

exit 0
3 changes: 3 additions & 0 deletions scripts/postuninst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exit 0
3 changes: 3 additions & 0 deletions scripts/postupgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exit 0
3 changes: 3 additions & 0 deletions scripts/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exit 0
3 changes: 3 additions & 0 deletions scripts/preuninst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exit 0
3 changes: 3 additions & 0 deletions scripts/preupgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exit 0
Loading

0 comments on commit f4cdc8a

Please sign in to comment.