diff --git a/conf/app.src b/conf/app.src index 09b2b8a..c9cbc23 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/MediaBrowser/Emby.Releases/releases/download/3.5.3.0/emby-server-deb_3.5.3.0_amd64.deb -SOURCE_SUM=ae9acfa988b87fe91c51caae3e3512d1a05c23744d50fde5e6ef935da959b473113e635050466ba03c2ebd0a286e1d28fd9557f1d1235c538f29376a5153fbdb +SOURCE_URL=https://github.com/PufferPanel/PufferPanel/releases/download/v1.2.4/pufferpanel.tar.gz +SOURCE_SUM=073b85822afa0dae63a8f7f2f1ee05c2860a7e9375985c6013faa2a06cf88012bebd8ab576eca0d308d183e857c76e353150fcc3090ae18e3eb5253194be92aa SOURCE_SUM_PRG=sha512sum -SOURCE_FORMAT=deb -SOURCE_IN_SUBDIR=false -SOURCE_EXTRACT=false -SOURCE_FILENAME=emby-server-deb.deb \ No newline at end of file +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_EXTRACT=true +SOURCE_FILENAME=pufferpanel.tar.gz \ No newline at end of file diff --git a/scripts/install b/scripts/install index 3cc412e..389576f 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ app=$YNH_APP_INSTANCE_NAME ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" -final_path=/opt/yunohost/$app +final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" # Normalize the url path syntax @@ -81,6 +81,48 @@ port=$(ynh_find_port 8096) yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port +#============================================== +# INSTALL DEPS +#============================================== + +ynh_package_install openssl curl mysql-client mysql-server php-fpm php-cli php-curl php-mysql + +# Install Other Dependencies +echo "Installing some dependencies" +if [ $OS_INSTALL_CMD == 'apt' ]; then + if [ $(lsb_release -sc) == 'jessie' ]; then + sudo echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/backports.list + dpkg --add-architecture i386 + apt-get update + apt-get install -y -t jessie-backports openjdk-8-jdk-headless + apt-get install -y openssl curl git tar lib32gcc1 lib32tinfo5 lib32z1 lib32stdc++6 libcurl3-gnutls:i386 + elif [ $(lsb_release -sc) == 'trusty' ]; then + sudo add-apt-repository -y ppa:openjdk-r/ppa + dpkg --add-architecture i386 + apt-get update + apt-get install -y openssl curl git openjdk-8-jdk-headless tar lib32gcc1 lib32tinfo5 lib32z1 lib32stdc++6 libcurl3-gnutls:i386 + else + dpkg --add-architecture i386 + apt-get update + apt-get install -y openssl curl git openjdk-8-jdk-headless tar lib32gcc1 lib32tinfo5 lib32z1 lib32stdc++6 libcurl3-gnutls:i386 + fi + curl -s https://packagecloud.io/install/repositories/pufferpanel/${pufferdRepo}/script.deb.sh | bash +elif [ $OS_INSTALL_CMD == 'yum' ]; then + yum -y install openssl curl git java-1.8.0-openjdk-devel tar glibc.i686 libstdc++.i686 libcurl.i686 + curl -s https://packagecloud.io/install/repositories/pufferpanel/${pufferdRepo}/script.rpm.sh | bash +elif [ $OS_INSTALL_CMD == 'pacman' ]; then + grep -e "^\[multilib\]$" /etc/pacman.conf &> /dev/null + if [ $? -eq 0 ]; then + pacman -S openssl curl git jdk8-openjdk tar lib32-glibc lib32-gcc-libs --noconfirm --needed + else + echo -e "Please enable [multilib] in /etc/pacman.conf for lib32 libraries" + fi +fi + + +#Adding repo of pufferd +#curl -s https://packagecloud.io/install/repositories/pufferpanel/pufferd/script.deb.sh + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -90,10 +132,99 @@ ynh_app_setting_set $app final_path $final_path ynh_setup_source "$final_path" #============================================== -# INSTALL EMBY +# INSTALL PufferPanel #============================================== -dpkg --install $final_path/emby-server-deb* +#Install Panel +#mv $final_path/ + + +#Install Daemon +mkdir -p /var/lib/pufferd /var/log/pufferd /etc/pufferd +wget https://packagecloud.io/pufferpanel/pufferd/packages/debian/stretch/pufferd_1.2.5_amd64.deb/download.deb +dpkg --install download.deb + +echo -e "Installing pufferd using package manager" +pufferdLocation="/srv/pufferd" +installed=0 +if [ $OS_INSTALL_CMD == 'apt' ]; then + apt-get update + apt-get install pufferd + pufferdLocation="/usr/sbin/" +elif [ $OS_INSTALL_CMD == 'yum' ]; then + yum install -y pufferd + pufferdLocation="/usr/sbin/" +fi + +if [ -f "${pufferdLocation}/pufferd" ]; then + echo "Detected installation via package successful" +else + echo -e "Failed to install using package manager, manually installing" + echo -e "Downloading pufferd from $downloadUrl" + pufferdLocation="/srv/pufferd/" + mkdir -p /srv/pufferd + curl -L -o /srv/pufferd/pufferd $downloadUrl + checkResponseCode + chmod +x /srv/pufferd/pufferd + checkResponseCode + writeServiceFile + checkResponseCode + useradd --system --home /var/lib/pufferd --user-group pufferd +fi + +if type systemctl &> /dev/null; then + echo "Stopping service to prepare for installation" + systemctl stop pufferd +elif type service &> /dev/null; then + echo "Stopping service to prepare for installation" + service pufferd stop +fi + +if [ -f "${pufferdLocation}/pufferd" ]; then + echo "Detected installation via package successful" +else + echo -e "Failed to install using package manager, manually installing" + echo -e "Downloading pufferd from $downloadUrl" + pufferdLocation="/srv/pufferd/" + mkdir -p /srv/pufferd + curl -L -o /srv/pufferd/pufferd $downloadUrl + checkResponseCode + chmod +x /srv/pufferd/pufferd + checkResponseCode + writeServiceFile + checkResponseCode + useradd --system --home /var/lib/pufferd --user-group pufferd +fi + +if type systemctl &> /dev/null; then + echo "Stopping service to prepare for installation" + systemctl stop pufferd +elif type service &> /dev/null; then + echo "Stopping service to prepare for installation" + service pufferd stop +fi + +cd $pufferdLocation +echo -e "Executing pufferd installation" +./pufferd --install --auth http://yuno2.probetech.be --token 64F263CF-F18C-4C11-A118-81E2435B2A86 --config /etc/pufferd/config.json +checkResponseCode + +chown -R pufferd:pufferd /var/lib/pufferd /etc/pufferd /var/log/pufferd +if [ -f /srv/pufferd ]; then + chown -R pufferd:pufferd /srv/pufferd +fi + +if type systemctl &> /dev/null; then + echo "Starting pufferd service" + systemctl start pufferd + systemctl enable pufferd +elif type service &> /dev/null; then + echo "Starting pufferd service" + service pufferd start +fi + +echo "Successfully installed the daemon" + #================================================= # NGINX CONFIGURATION