diff --git a/misc/package/ASUStor/CONTROL/icon-disable.png b/misc/package/ASUStor/CONTROL/icon-disable.png deleted file mode 100644 index e0ce2c1a688..00000000000 Binary files a/misc/package/ASUStor/CONTROL/icon-disable.png and /dev/null differ diff --git a/misc/package/ASUStor/CONTROL/icon-enable.png b/misc/package/ASUStor/CONTROL/icon-enable.png deleted file mode 100644 index 4c06045b1d6..00000000000 Binary files a/misc/package/ASUStor/CONTROL/icon-enable.png and /dev/null differ diff --git a/misc/package/ASUStor/apkg_build b/misc/package/ASUStor/apkg_build deleted file mode 100644 index 091e936100f..00000000000 --- a/misc/package/ASUStor/apkg_build +++ /dev/null @@ -1,441 +0,0 @@ -#!/bin/sh - -# pkg-build -- construct a debian file format .apk from a directory -# Walker Lee -# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001 - -set -e - -TMP_DIR="/tmp" -THIS_DIR=`pwd` -SCRIPT_PATH=`readlink -f $0` -SCRIPT_DIR=`dirname ${SCRIPT_PATH}` - -JSON_GREP="python $SCRIPT_DIR/jsongrep.py" - -PKG_BUILD_PROGRAM=`basename $0` -#PKG_BUILD_PROGRAM="apkg-build" -PKG_BUILD_VER="1.0" -PKG_BUILD_FORMAT="zip" # ar, tar, zip - -PKG_CONTROL_DIR="CONTROL" -PKG_WEBMAN_DIR="webman" -PKG_WEB_DIR="www" - -PKG_WEB_USER="admin" -PKG_WEB_GROUP="administrators" - -PKG_WEB_USER_ID=999 -PKG_WEB_GROUP_ID=999 - -PKG_WEB_PERM=770 - -PKG_DIR_PERM=755 -PKG_FILE_PERM=644 - -PKG_VERSION_FILE="apkg-version" -PKG_DATA_FILE="data.tar.gz" -PKG_CONTROL_FILE="control.tar.gz" - -PKG_CONFIG_FILE="config.json" -PKG_ICON_ENABLE_FILE="icon-enable.png" -PKG_ICON_DISABLE_FILE="icon-disable.png" - -PKG_PRE_INSTALL_SCRIPT="pre-install.sh" -PKG_PRE_UNINSTALL_SCRIPT="pre-uninstall.sh" - -PKG_POST_INSTALL_SCRIPT="post-install.sh" -PKG_POST_UNINSTALL_SCRIPT="post-uninstall.sh" - -PKG_START_STOP_SCRIPT="start-stop.sh" - -PKG_SCRIPT_LIST="$PKG_PRE_INSTALL_SCRIPT $PKG_PRE_UNINSTALL_SCRIPT \ - $PKG_POST_INSTALL_SCRIPT $PKG_POST_UNINSTALL_SCRIPT \ - $PKG_START_STOP_SCRIPT" - -PKG_SRC_DIR=$1 -PKG_DEST_DIR=$2 -PKG_TMP_DIR=$TMP_DIR/APKG_BUILD.$$ - -PKG_SUFFIX="apk" - - -pkg_struct_check() { - local owd=`pwd` - local error=0 - - # check pkg base dir - if [ ! -d $PKG_SRC_DIR ]; then - echo " *** Error: Directory $PKG_SRC_DIR does not exist" >&2 - return 1 - fi - - cd $PKG_SRC_DIR - - # check pkg control dir - if [ ! -d "$PKG_CONTROL_DIR" ]; then - echo " *** Error: Directory $PKG_SRC_DIR has no $PKG_CONTROL_DIR subdirectory." >&2 - error=1 - fi - - # check pkg config file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_CONFIG_FILE" ]; then - echo " *** Error: Package config file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_CONFIG_FILE not found." >&2 - error=1 - fi - - # TODO: check pkg config file is utf8 format - - # check enable pkg icon file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_ICON_ENABLE_FILE" ]; then - echo " *** Error: Package enable icon file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_ICON_ENABLE_FILE not found." >&2 - error=1 - fi - - # check disable pkg icon file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_ICON_DISABLE_FILE" ]; then - echo " *** Error: Package disable icon file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_ICON_DISABLE_FILE not found." >&2 - error=1 - fi - - cd $owd - - return $error -} - -required_field() { - field=$1 - - raw_value=`$JSON_GREP app $field < $PKG_CONTROL_DIR/$PKG_CONFIG_FILE` - value=`expr "$raw_value" : '..\(.*\).'` - if [ -z "$value" ]; then - echo " *** Error: $PKG_CONTROL_DIR/$PKG_CONFIG_FILE is missing field $field" >&2 - return 1 - fi - echo $value - return 0 -} - -pkg_config_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - PKG_FIELD_PACKAGE=`required_field package` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_NAME=`required_field name` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_VERSION=`required_field version` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_SECTION=`required_field section` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_VISIBILITY=`required_field visibility` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_PRIORITY=`required_field priority` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_MAINTAINER=`required_field maintainer` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_EMAIL=`required_field email` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_WEBSITE=`required_field website` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_ARCHITECTURE=`required_field architecture` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_FIRMWARE=`required_field firmware` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_DESCRIPTION=`required_field description` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_CHANGES=`required_field changes` -# [ "$?" -ne 0 ] && error=1 - -# PKG_FIELD_TAGS=`required_field tags` -# [ "$?" -ne 0 ] && error=1 - - if echo $PKG_FIELD_PACKAGE | grep '[^a-z0-9.+-]' > /dev/null 2>&1; then - if [ $error -eq 1 ]; then - echo >&2 - fi - echo " *** Error: Package name $PKG_FIELD_PACKAGE contains illegal characters, (other than [a-z0-9.+-])" >&2 - error=1 - fi - -# if [ -z "$PKG_FIELD_SECTION" ]; then -# if [ $error -eq 1 ]; then -# echo >&2 -# fi -# echo " The Section field should have one of the following values:" >&2 -# echo " admin, base, comm, editors, extras, games, graphics, kernel, libs, misc, net, text, web, x11" >&2 -# fi - - if [ -z "$PKG_FIELD_PRIORITY" ]; then - if [ $error -eq 1 ]; then - echo >&2 - fi - echo " The Priority field should have one of the following values:" >&2 - echo " required, important, standard, optional, extra" >&2 - echo " If you don't know which priority value you should be using, then use \`optional'" >&2 - - fi - - cd $owd - - return $error -} - -pkg_script_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - for script_file in $PKG_SCRIPT_LIST; do - if [ -f $PKG_CONTROL_DIR/$script_file -a ! -x $PKG_CONTROL_DIR/$script_file ]; then - echo " *** Error: package script $PKG_CONTROL_DIR/$script_file is not executable" >&2 - error=1 - fi - done - - cd $owd - - return $error -} - -pkg_misc_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - tilde_files=`find . -name '*~'` - if [ -n "$tilde_files" ]; then - echo "*** Warning: The following files have names ending in '~'. -You probably want to remove them: " >&2 - ls -ld $tilde_files - echo >&2 - fi - - swap_files=`find . -name '*.swp'` - if [ -n "$swap_files" ]; then - echo "*** Warning: The following files have names ending in '.swp'. -You probably want to remove them: " >&2 - ls -ld $swap_files - echo >&2 - fi - - svn_files=`find . -name '.svn'` - if [ -n "$svn_files" ]; then - echo "*** Warning: The following files have names ending in '.svn'. -You probably want to remove them: " >&2 - ls -ld $svn_files - echo >&2 - fi - - git_files=`find . -name '*.git'` - if [ -n "$git_files" ]; then - echo "*** Warning: The following files have names ending in '.git'. -You probably want to remove them: " >&2 - ls -ld $git_files - echo >&2 - fi - - cvs_files=`find . -name '*.cvs'` - if [ -n "$cvs_files" ]; then - echo "*** Warning: The following files have names ending in '.cvs'. -You probably want to remove them: " >&2 - ls -ld $cvs_files - echo >&2 - fi - -# maybe check SUID & GUID file - -# large_uid_files=`find . -uid +99` -# if [ -n "$large_uid_files" ]; then -# echo "*** Warning: The following files have a UID greater than 99. -#You probably want to chown these to a system user: " >&2 -# ls -ld $large_uid_files -# echo >&2 -# fi - - cd $owd - - return $error -} - -### -# apkg-build "main" -### - -# set pkg dest dir -case $# in -1) - PKG_SRC_DIR=`readlink -f $PKG_SRC_DIR` - PKG_DEST_DIR=$THIS_DIR - ;; -2) - PKG_SRC_DIR=`readlink -f $PKG_SRC_DIR` - PKG_DEST_DIR=`readlink -f $PKG_DEST_DIR` - ;; -*) - echo "Usage: $PKG_BUILD_PROGRAM []" >&2 - exit 1 - ;; -esac - -if [ $PKG_SRC_DIR = $PKG_DEST_DIR ]; then - echo "*** Error: Can't not build pkg in the same directory" >&2 - echo " pkg_directory: $PKG_SRC_DIR" >&2 - echo " destination_directory: $PKG_DEST_DIR" >&2 - exit 1 -fi - -# check pkg package folder structure -echo "Check package folder structure..." -if ! pkg_struct_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg config -echo "Check package config information..." -if ! pkg_config_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg script -echo "Check package script file..." -if ! pkg_script_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg misc -echo "Check package misc..." -if ! pkg_misc_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# archive pkg control script -mkdir -p $PKG_TMP_DIR - -# force chown user:group to web folder -if [ -d $PKG_SRC_DIR/$PKG_WEB_DIR ]; then - echo -n "Force change $PKG_SRC_DIR/$PKG_WEB_DIR/* owner and group to $PKG_WEB_USER:$PKG_WEB_GROUP ... " - if [ `ls -la $PKG_SRC_DIR/$PKG_WEB_DIR | wc -l` -gt 3 ]; then - # change owner - sudo chown $PKG_WEB_USER_ID:$PKG_WEB_GROUP_ID $PKG_SRC_DIR/$PKG_WEB_DIR -R - # TODO change file permission - # chmod $PKG_WEB_PERM $PKG_SRC_DIR/$PKG_WEB_DIR -R - fi - echo "Done" - - echo -fi - -echo -n "Archive package data..." -tar -C $PKG_SRC_DIR -czf $PKG_TMP_DIR/$PKG_DATA_FILE . --exclude=$PKG_CONTROL_DIR -echo "Done" - -echo - -# archive pkg data -echo -n "Archive package control script..." -tar -C $PKG_SRC_DIR/$PKG_CONTROL_DIR -czf $PKG_TMP_DIR/$PKG_CONTROL_FILE . -echo "Done" - -echo - -# generate pkg version -echo -n "Generate $PKG_VERSION_FILE..." -echo $PKG_BUILD_VER > $PKG_TMP_DIR/$PKG_VERSION_FILE -echo "Done" - -echo - -# prepare pkg filename -PKG_ARCHIVE_FILE=${PKG_FIELD_PACKAGE}_${PKG_FIELD_VERSION}_${PKG_FIELD_ARCHITECTURE}.$PKG_SUFFIX - -# use which type archive -echo "Use $PKG_BUILD_FORMAT format to archive $PKG_ARCHIVE_FILE..." -cd $PKG_TMP_DIR - -PKG_ARCHIVE_LIST="./$PKG_VERSION_FILE ./$PKG_DATA_FILE ./$PKG_CONTROL_FILE" - -rm -rf $TMP_DIR/$PKG_ARCHIVE_FILE - -if [ "$PKG_BUILD_FORMAT" = "ar" ] ; then - ar -crvf $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -elif [ "$PKG_BUILD_FORMAT" = "tar" ] ; then - tar -zcvf $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -elif [ "$PKG_BUILD_FORMAT" = "zip" ] ; then - zip -r $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -fi -echo "Done" - -PKG_SIZE=`ls -l $TMP_DIR/$PKG_ARCHIVE_FILE | awk '{print $5}'` -PKG_MD5=`md5sum $TMP_DIR/$PKG_ARCHIVE_FILE | cut -d' ' -f1` -PKG_SHA1=`sha1sum $TMP_DIR/$PKG_ARCHIVE_FILE | cut -d' ' -f1` - -# move pkg to dest dir -[ "$PKG_DEST_DIR" != "$TMP_DIR" ] && mkdir -p $PKG_DEST_DIR && mv $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_DEST_DIR - -echo - -# clean up -echo -n "Clean building data..." -rm -f $PKG_TMP_DIR/$PKG_VERSION_FILE $PKG_TMP_DIR/$PKG_DATA_FILE $PKG_TMP_DIR/$PKG_CONTROL_FILE -rmdir $PKG_TMP_DIR -echo "Done" - -echo - -echo "Package Summary" -echo " Source: $PKG_SRC_DIR" -echo " Destination: $PKG_DEST_DIR" -echo " Package: $PKG_FIELD_PACKAGE" -echo " Name: $PKG_FIELD_NAME" -echo " Version: $PKG_FIELD_VERSION" -echo " Section: $PKG_FIELD_SECTION" -echo " Visibility: $PKG_FIELD_VISIBILITY" -echo " Priority: $PKG_FIELD_PRIORITY" -echo " Maintainer: $PKG_FIELD_MAINTAINER" -echo " Email: $PKG_FIELD_EMAIL" -echo " WebSite: $PKG_FIELD_WEBSITE" -echo " Architecture: $PKG_FIELD_ARCHITECTURE" -echo " Firmware: $PKG_FIELD_FIRMWARE" -echo " Description: $PKG_FIELD_DESCRIPTION" -echo " Changes: $PKG_FIELD_CHANGES" -echo " File: $PKG_ARCHIVE_FILE" -echo " Size: $PKG_SIZE" -echo " MD5sum: $PKG_MD5" -echo " SHA1sum: $PKG_SHA1" diff --git a/misc/package/ASUStor/build.sh b/misc/package/ASUStor/build.sh deleted file mode 100644 index 06d6d9e74f7..00000000000 --- a/misc/package/ASUStor/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -LATEST=`curl -s http://api.piwik.org/1.0/getLatestVersion/` -curl -s http://builds.piwik.org/piwik-$LATEST.tar.gz | gunzip | tar xf - - -mkdir -p Piwik/CONTROL -mv piwik Piwik/www - -sed "s/{{VERSION}}/$LATEST/" Piwik/CONTROL/config.json -cp ../../gpl-3.0.txt Piwik/CONTROL/license.txt -cp CONTROL/*.png Piwik/CONTROL/ - -sh apkg_build Piwik diff --git a/misc/package/ASUStor/config.json.tpl b/misc/package/ASUStor/config.json.tpl deleted file mode 100644 index 9062331e3d6..00000000000 --- a/misc/package/ASUStor/config.json.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{ - "app":{ - "package":"piwik", - "name":"Piwik", - "version":"{{VERSION}}", - "section":"Web Hosting", - "visibility":true, - "priority":"optional", - "depends":[], - "conflicts":[], - "suggests":[], - "maintainer":"Piwik", - "email":"hello@piwik.org", - "website":"http://piwik.org/", - "architecture":"any", - "firmware":"any", - "description":"Open source, self-hosted web analytics.", - "changes":"http://piwik.org/changelog/", - "tags":["analytics", "visits", "visitors", "hits"] - }, - "desktop":{ - "icon":{ - "type":"webserver", - "title":"Piwik" - }, - "privilege":{ - "accessible":"users", - "customizable":true - } - }, - "install":{ - "dep-service":{ - "start":["httpd", "mysql"], - "restart":[] - } - } -} diff --git a/misc/package/ASUStor/jsongrep.py b/misc/package/ASUStor/jsongrep.py deleted file mode 100644 index 7b1b4713a01..00000000000 --- a/misc/package/ASUStor/jsongrep.py +++ /dev/null @@ -1,37 +0,0 @@ -#Original author: Terry Jones (http://blogs.fluidinfo.com/terry/about/) -#Source: http://blogs.fluidinfo.com/terry/2010/11/25/jsongrep-py-python-for-extracting-pieces-of-json-objects/ - -#!/usr/bin/env python - -import sys -import re -import json -from pprint import pprint - -def jsongrep(d, patterns): - try: - pattern = patterns.pop(0) - except IndexError: - pprint(d) - else: - if isinstance(d, dict): - keys = filter(pattern.match, d.keys()) - elif isinstance(d, list): - keys = map(int, - filter(pattern.match, - ['%d' % i for i in range(len(d))])) - else: - if pattern.match(str(d)): - pprint(d) - return - for item in (d[key] for key in keys): - jsongrep(item, patterns[:]) - -if __name__ == '__main__': - try: - j = json.loads(sys.stdin.read()) - except ValueError, e: - print >>sys.stderr, 'Could not load JSON object from stdin.' - sys.exit(1) - - jsongrep(j, map(re.compile, sys.argv[1:])) diff --git a/misc/package/QNAP/build.sh b/misc/package/QNAP/build.sh deleted file mode 100644 index 0ef74e21c7b..00000000000 --- a/misc/package/QNAP/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -LATEST=`curl -s http://api.piwik.org/1.0/getLatestVersion/` -curl -s http://builds.piwik.org/piwik-$LATEST.tar.gz | gunzip | tar xf - - -cp icons/qpkg_icon_80.gif piwik/.qpkg_icon_80.gif -cp icons/qpkg_icon.gif piwik/.qpkg_icon.gif -cp icons/qpkg_icon_gray.gif piwik/.qpkg_icon_gray.gif - -tar cf - piwik | gzip >Piwik.tgz - -sed "s/{{VERSION}}/$LATEST/" qpkg.cfg - -cp header.qpkg Piwik_$LATEST.qpkg -tar zcf - qinstall.sh Piwik.tgz qpkg.cfg >>Piwik_$LATEST.qpkg - -zip Piwik_$LATEST.zip Piwik_$LATEST.qpkg diff --git a/misc/package/QNAP/header.qpkg b/misc/package/QNAP/header.qpkg deleted file mode 100644 index 7a143ecd195..00000000000 --- a/misc/package/QNAP/header.qpkg +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -/bin/echo "Install QNAP package on TS-NAS ..." -/bin/grep "/mnt/HDA_ROOT" /proc/mounts 1>>/dev/null 2>>/dev/null -[ $? = 0 ] || return 1 -[ -d /mnt/HDA_ROOT/update_pkg/tmp ] || /bin/mkdir -p /mnt/HDA_ROOT/update_pkg/tmp -/bin/dd if=${0} bs=487 skip=1 | /bin/tar zxv -C /mnt/HDA_ROOT/update_pkg/tmp -[ $? = 0 ] || return 1 -cd /mnt/HDA_ROOT/update_pkg/tmp && ( /bin/sh qinstall.sh || echo "Installation Abort." ) && cd .. && /bin/rm -rf /mnt/HDA_ROOT/update_pkg/tmp && exit 10 -exit 1 diff --git a/misc/package/QNAP/icons/qpkg_icon.gif b/misc/package/QNAP/icons/qpkg_icon.gif deleted file mode 100755 index eec1713ce21..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon.gif and /dev/null differ diff --git a/misc/package/QNAP/icons/qpkg_icon_80.gif b/misc/package/QNAP/icons/qpkg_icon_80.gif deleted file mode 100755 index 43fefcb95f4..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon_80.gif and /dev/null differ diff --git a/misc/package/QNAP/icons/qpkg_icon_gray.gif b/misc/package/QNAP/icons/qpkg_icon_gray.gif deleted file mode 100755 index 7efe51ce9d2..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon_gray.gif and /dev/null differ diff --git a/misc/package/QNAP/qinstall.sh b/misc/package/QNAP/qinstall.sh deleted file mode 100755 index 3f834fe1d54..00000000000 --- a/misc/package/QNAP/qinstall.sh +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/sh -#================================================================ -# Copyright (C) 2010 QNAP Systems, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -#---------------------------------------------------------------- -# -# qinstall.sh -# -# Abstract: -# A QPKG installation script for -# Piwik v1.0 -# -# HISTORY: -# 2008/03/26 - Created - KenChen -# 2010/11/05 - Modified - AndyChuo (zeonism at gmail dot com) -# 2012/07/28 - Modified - Anthon Pang (anthon at piwik dot org) -# -#================================================================ - -##### Util ##### -CMD_APACHE="/usr/local/apache/bin/apachectl" -CMD_CP="/bin/cp" -CMD_CUT="/bin/cut" -CMD_CHMOD="/bin/chmod" -CMD_ECHO="/bin/echo" -CMD_GETCFG="/sbin/getcfg" -CMD_GREP="/bin/grep" -CMD_LN="/bin/ln" -CMD_MKTEMP="/bin/mktemp" -CMD_MKDIR="/bin/mkdir" -CMD_PIDOF="/bin/pidof" -CMD_READLINK="/usr/bin/readlink" -CMD_RM="/bin/rm" -CMD_SETCFG="/sbin/setcfg" -CMD_SYNC="/bin/sync" -CMD_SETCFG="/sbin/setcfg" -CMD_SLEEP="/bin/sleep" -CMD_TAR="/bin/tar" -CMD_TOUCH="/bin/touch" -CMD_WLOG="/sbin/write_log" - -##### System ##### -UPDATE_PROCESS="/tmp/update_process" -UPDATE_PB=0 -UPDATE_P1=1 -UPDATE_P2=2 -UPDATE_PE=3 - -SYS_HOSTNAME=`/bin/hostname` -SYS_IP=`$CMD_GREP "${SYS_HOSTNAME}" /etc/hosts | $CMD_CUT -f 1` -SYS_CONFIG_DIR="/etc/config" #put the configuration files here -SYS_INIT_DIR="/etc/init.d" -SYS_rcS_DIR="/etc/rcS.d/" -SYS_rcK_DIR="/etc/rcK.d/" -SYS_QPKG_CONFIG_FILE="/etc/config/qpkg.conf" #qpkg infomation file -SYS_QPKG_CONF_FIELD_NAME="Name" -SYS_QPKG_CONF_FIELD_VERSION="Version" -SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File" -SYS_QPKG_CONF_FIELD_ENABLE="Enable" -SYS_QPKG_CONF_FIELD_DATE="Date" -SYS_QPKG_CONF_FIELD_SHELL="Shell" -SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path" -SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path" -SYS_QPKG_CONF_FIELD_WEBUI="WebUI" -SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port" -SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port" -SYS_QPKG_CONF_FIELD_AUTHOR="Author" -SYS_WEB_STATUS=`${CMD_GETCFG} QWEB enable` -PUBLIC_SHARE=`/sbin/getcfg SHARE_DEF defPublic -d Public -f /etc/config/def_share.info` -WEB_SHARE=`/sbin/getcfg SHARE_DEF defWeb -d Qweb -f /etc/config/def_share.info` - -##### QPKG ##### -# -. qpkg.cfg -##### Func ###### -# -find_base(){ - # Determine BASE installation location according to smb.conf - - publicdir=`/sbin/getcfg Public path -f /etc/config/smb.conf` - if [ ! -z $publicdir ] && [ -d $publicdir ];then - publicdirp1=`/bin/echo $publicdir | /bin/cut -d "/" -f 2` - publicdirp2=`/bin/echo $publicdir | /bin/cut -d "/" -f 3` - publicdirp3=`/bin/echo $publicdir | /bin/cut -d "/" -f 4` - if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then - [ -d "/${publicdirp1}/${publicdirp2}/${PUBLIC_SHARE}" ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}" - fi - fi - - # Determine BASE installation location by checking where the Public folder is. - if [ -z $QPKG_BASE ]; then - for datadirtest in /share/HDA_DATA /share/HDB_DATA /share/HDC_DATA /share/HDD_DATA /share/MD0_DATA /share/MD1_DATA; do - [ -d $datadirtest/$PUBLIC_SHARE ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}" - done - fi - if [ -z $QPKG_BASE ] ; then - echo "The ${PUBLIC_SHARE} share not found." - _exit 1 - fi - -} - -_exit(){ - local ret=0 - - case $1 in - 0)#normal exit - ret=0 - if [ "x$QPKG_INSTALL_MSG" != "x" ]; then - $CMD_WLOG "${QPKG_INSTALL_MSG}" 4 - else - $CMD_WLOG "${QPKG_NAME} ${QPKG_VER} installation succeeded." 4 - fi - $CMD_ECHO "$UPDATE_PE" > ${UPDATE_PROCESS} - ;; - *) - ret=1 - if [ "x$QPKG_INSTALL_MSG" != "x" ];then - $CMD_WLOG "${QPKG_INSTALL_MSG}" 1 - else - $CMD_WLOG "${QPKG_NAME} ${QPKG_VER} installation failed" 1 - fi - $CMD_ECHO -1 > ${UPDATE_PROCESS} - ;; - esac - - exit $ret -} - -pre_update() -{ - TMP_DIR=/tmp - $CMD_CP -af $QPKG_CONFIG_PATH $TMP_DIR -} - -post_update() -{ - $CMD_CP -af "${TMP_DIR}/config.ini.php" ${QPKG_CONFIG_PATH} -} - -install() -{ - TMP=`$CMD_READLINK $QPKG_INSTALL_PATH` - UPDATE_FLAG=0 - if [ -f "${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE}" ]; then - if [ -d ${QPKG_DIR} ]; then - CURRENT_QPKG_VER="`/sbin/getcfg ${QPKG_NAME} Version -f /etc/config/qpkg.conf`" - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} is already installed. Setup will now perform package upgrading." - $CMD_ECHO "$QPKG_INSTALL_MSG" - UPDATE_FLAG=1 - fi - - $CMD_ECHO "$UPDATE_P1" > ${UPDATE_PROCESS} - if [ $UPDATE_FLAG -eq 0 ]; then - $CMD_ECHO "Install ${QPKG_NAME} ..." - [ ! -d $QPKG_DIR ] || $CMD_RM -rf $QPKG_DIR - else - pre_update - fi - - #install QPKG files - $CMD_TAR xzf "${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE}" -C $QPKG_INSTALL_PATH - if [ $? = 0 ]; then - # restore backups - if [ ${UPDATE_FLAG} -eq 1 ]; then - post_update - else - $CMD_CHMOD 0777 "${QPKG_DIR}" - $CMD_CHMOD 0777 -R "${QPKG_DIR}/config" - $CMD_CHMOD 0777 -R "${QPKG_DIR}/tmp" - - $CMD_MKDIR -p ${QPKG_DIR}/tmp/{sessions, templates_c, cache, assets, latest, tcpdf} - $CMD_CHMOD 0777 -R "${QPKG_DIR}/tmp/" - fi - - chown httpdusr.everyone ${QPKG_DIR} -R - - $CMD_ECHO "$UPDATE_P2" > ${UPDATE_PROCESS} - else - ${CMD_RM} -rf ${QPKG_DIR} - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} installation failed. ${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE} file error." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 1 - fi - - # set QPKG information to $SYS_QPKG_CONFIG_FILE - $CMD_ECHO "Set QPKG information to $SYS_QPKG_CONFIG_FILE" - [ -f ${SYS_QPKG_CONFIG_FILE} ] || $CMD_TOUCH ${SYS_QPKG_CONFIG_FILE} - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_NAME} "${QPKG_NAME}" -f ${SYS_QPKG_CONFIG_FILE} - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_VERSION} "${QPKG_VER}" -f ${SYS_QPKG_CONFIG_FILE} - - #default value to activate(or not) your QPKG if it was a service/daemon - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_ENABLE} "UNKNOWN" -f ${SYS_QPKG_CONFIG_FILE} - - #set the qpkg file name - [ "x${SYS_QPKG_CONF_FIELD_QPKGFILE}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_QPKGFILE} "${QPKG_QPKG_FILE}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the date of installation - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_DATE} `date +%F` -f ${SYS_QPKG_CONFIG_FILE} - - #set the path of start/stop shell script - [ "x${QPKG_SERVICE_PROGRAM}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_SHELL} "${QPKG_DIR}/${QPKG_SERVICE_PROGRAM}" -f ${SYS_QPKG_CONFIG_FILE} - - #set path where the QPKG installed - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_INSTALL_PATH} "${QPKG_DIR}" -f ${SYS_QPKG_CONFIG_FILE} - - #set path where the QPKG configure directory/file is - [ "x${QPKG_CONFIG_PATH}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_CONFIG_PATH} "${QPKG_CONFIG_PATH}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the port number if your QPKG was a service/daemon and needed a port to run. - [ "x${QPKG_SERVICE_PORT}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_SERVICEPORT} "${QPKG_SERVICE_PORT}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the port number if your QPKG was a service/daemon and needed a port to run. - [ "x${QPKG_WEB_PORT}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_WEBPORT} "${QPKG_WEB_PORT}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the URL of your QPKG Web UI if existed. - [ "x${QPKG_WEBUI}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_WEBUI} "${QPKG_WEBUI}" -f ${SYS_QPKG_CONFIG_FILE} - - #Sign up - [ "x${QPKG_AUTHOR}" = "x" ] && $CMD_ECHO "Warning: ${SYS_QPKG_CONF_FIELD_AUTHOR} is not specified!!" - [ "x${QPKG_AUTHOR}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_AUTHOR} "${QPKG_AUTHOR}" -f ${SYS_QPKG_CONFIG_FILE} - - $CMD_SYNC - QPKG_INSTALL_MSG="$QPKG_NAME ${QPKG_VER} has been installed in $QPKG_DIR." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 0 - else - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} installation failed. ${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE} file not found." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 1 - fi -} - -##### Main ##### - -$CMD_ECHO "$UPDATE_PB" > ${UPDATE_PROCESS} -install diff --git a/misc/package/QNAP/qpkg.cfg.tpl b/misc/package/QNAP/qpkg.cfg.tpl deleted file mode 100644 index a97631cbb12..00000000000 --- a/misc/package/QNAP/qpkg.cfg.tpl +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -#================================================================ -# Copyright (C) 2010 QNAP Systems, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -#---------------------------------------------------------------- -# -# qpkg_all.cfg -# -# Abstract: -# A QPKG configuration file for -# Piwik v1.0 -# -# HISTORY: -# 2010/11/05 - Created - AndyChuo (zeonism at gmail dot com) -# 2012/07/28 - Modified - Anthon Pang (anthon at piwik dot org) -# -#================================================================ -QPKG_AUTHOR="QNAP Systems, Inc." -QPKG_SOURCE_DIR="." -QPKG_QPKG_FILE="Piwik.qpkg" -QPKG_SOURCE_FILE="Piwik.tgz" -QPKG_NAME="Piwik" -QPKG_VER="{{VERSION}}" -QPKG_MAJOR_VER="1" -QPKG_MINOR_VER="0" -QPKG_TYPE="Web Applications" -QPKG_LOG_PATH="" -QPKG_INSTALL_PATH="/share/${WEB_SHARE}" -QPKG_CONFIG_PATH="$QPKG_INSTALL_PATH/piwik/config/config.ini.php" -QPKG_DIR="$QPKG_INSTALL_PATH/piwik" -QPKG_WEBUI="/piwik/" #URL relative path of your QPKG web interface led by "/" -QPKG_INSTALL_MSG="" -QPKG_WEB_PORT="" -QPKG_SERVICE_PORT=""