crowdsecurity / spksrc-crowdsec

Other
14 stars 3 forks source link

Discord

SynoCommunity is now on Discord!

Discord

DSM 7

DSM 7 was released on June 29 2021 as Version 7.0.41890.

In SynoCommunity some packages are available for DSM 7 but some are not.

spksrc

spksrc is a cross compilation framework intended to compile and package software for Synology NAS devices. Packages are made available via the SynoCommunity repository.

Contributing

Before opening a new issue, check the FAQ and search open issues. If you can't find an answer, or if you want to open a package request, read CONTRIBUTING to make sure you include all the information needed for contributors to handle your request.

Setup Development Environment

Docker

The Docker development environment supports Linux and macOS systems, but not Windows due to limitations of the underlying file system.

  1. Fork and clone spksrc: git clone https://github.com/YOUR-USERNAME/spksrc
  2. Install Docker on your host OS (see Docker installation, or use a wget-based alternative for linux Install Docker with wget).
  3. Download the spksrc Docker container: docker pull ghcr.io/synocommunity/spksrc
  4. Run the container with the repository mounted into the /spksrc directory with the appropriate command for your host Operating System:
cd spksrc # Go to the cloned repository's root folder.

# If running on Linux:
docker run -it -v $(pwd):/spksrc ghcr.io/synocommunity/spksrc /bin/bash

# If running on macOS:
docker run -it -v $(pwd):/spksrc -e TAR_CMD="fakeroot tar" ghcr.io/synocommunity/spksrc /bin/bash
  1. From there, follow the instructions in the Developers HOW TO.

LXC

A container based on 64-bit version of Debian 10 stable OS is recommended. Non-x86 architectures are not supported. The following assumes your lxd environment is already initiated (e.g. lxc init) and you have minimal LXD/LXC knowledge :

  1. Create a new container (will use x864_64/amd64 arch by default): lxc launch images:debian/10 spksrc
  2. Enable i386 arch: lxc exec spksrc -- /usr/bin/dpkg --add-architecture i386
  3. Update apt channels: lxc exec spksrc -- /usr/bin/apt update
  4. Install all required packages:
    lxc exec spksrc -- /usr/bin/apt install autogen autoconf-archive automake bc bison build-essential check \
                                cmake curl cython debootstrap ed expect flex g++-multilib gawk gettext git gperf \
                                imagemagick intltool jq libbz2-dev libc6-i386 libcppunit-dev libffi-dev libgc-dev \
                                libgmp3-dev libltdl-dev libmount-dev libncurses-dev libpcre3-dev libssl-dev \
                                libtool libunistring-dev lzip mercurial moreutils ncurses-dev ninja-build php \
                                pkg-config python3 python3-distutils rename scons subversion swig texinfo unzip \
                                xmlto zlib1g-dev
  5. Install python2 wheels:
    lxc exec spksrc -- /bin/bash -c "wget https://bootstrap.pypa.io/get-pip.py -O - | python2"
    lxc exec spksrc -- /bin/bash -c "pip2 install virtualenv httpie"
  6. Install python3 wheels:
    lxc exec spksrc -- /bin/bash -c "wget https://bootstrap.pypa.io/get-pip.py -O - | python3"
    lxc exec spksrc -- /bin/bash -c "pip3 install virtualenv httpie"
  7. Install meson (requires autoconf-archive): lxc exec spksrc -- /bin/bash -c "pip3 install meson==0.56.0"
  8. (OPTIONAL) Install misc base tools:
    lxc exec spksrc -- /usr/bin/apt install bash-completion man-db manpages-dev mlocate ripgrep rsync tree time
    lxc exec spksrc -- /usr/bin/updatedb

LXC: Shared spksrc user (OPTIONAL)

You can create a shared user between your Ubuntu and the LXC Debian container which simplifies greatly file management between the two. The following assumes you already create a user spksrc with uid 1001 in your Ubuntu environment and that you which to share its /home userspace.

  1. Create the spksrc user: lxc exec spksrc -- /usr/sbin/adduser --uid 1001 spksrc
  2. Create a mapping rule between the hosts and the LXC image:
    lxc config set spksrc raw.idmap "both 1001 1001"
    lxc restart spksrc
    Remapping container filesystem
  3. Add /home/spksrc from the hsot to the LXC container:
    lxc config device add spksrc home disk path=/home/spksrc source=/home/spksrc
    Device home added to spksrc
  4. Connect as spksrc user:
    lxc exec spksrc -- su --login spksrc
    spksrc@spksrc:~$
  5. Set a defualt shell environment:
    lxc exec spksrc -- su --login spksrc
    spksrc@spksrc:~$ cp /etc/skel/.profile /etc/skel/.bashrc .

    LXC: Proxy (OPTIONAL)

    The following assume you have a running proxy on your LAN setup at IP 192.168.1.1 listening on port 3128 that will allow caching files.

  6. Enforce using a proxy:
    lxc config set spksrc environment.http_proxy http://192.168.1.1:3128
    lxc config set spksrc environment.https_proxy http://192.168.1.1:3128
  7. Enforce using a proxy with wget in the spksrc container user account:
    lxc exec spksrc -- su --login spksrc
    spksrc@spksrc:~$ cat << EOF > $HOME/.wgetrc
    use_proxy = on
    http_proxy = http://192.168.1.1:3128/
    https_proxy = http://192.168.1.1:3128/
    ftp_proxy = http://192.168.1.1:3128/
    EOF

Virtual machine

A virtual machine based on an 64-bit version of Debian 10 stable OS is recommended. Non-x86 architectures are not supported.

Usage

Once you have a development environment set up, you can start building packages, create new ones, or improve upon existing packages while making your changes available to other people. See the Developers HOW TO for information on how to use spksrc.

License

When not explicitly set, files are placed under a 3 clause BSD license