diff --git a/build_and_install.sh b/build_and_install.sh index 71f2a57..9e95477 100755 --- a/build_and_install.sh +++ b/build_and_install.sh @@ -23,7 +23,11 @@ PACKAGE=$1 docker run -it -v $(pwd):/wdpksrc wdpk /bin/bash -c "cd wdpk/$PACKAGE; ./build.sh ; chown -R 1000:1000 ../../packages/$PACKAGE" # find latest package -PRODUCT="PR4100" # TODO: use env +if [ -z "$3" ]; then + PRODUCT="PR4100" # TODO: use env +else + PRODUCT="$3" +fi BINARY=$(find packages/$PACKAGE -name "*$PRODUCT*$PACKAGE*.bin" | sort | tail -n1) echo "Created $BINARY" diff --git a/wdpk/phpMyAdmin/README.md b/wdpk/phpMyAdmin/README.md new file mode 100644 index 0000000..2793dc7 --- /dev/null +++ b/wdpk/phpMyAdmin/README.md @@ -0,0 +1,5 @@ +# phpMyAdmin + +Latest version of myPhpAdmin with MySQL 5.4 support is 4.0.10.20. + +No longer support since April 1 2017! diff --git a/wdpk/phpMyAdmin/admin.sql b/wdpk/phpMyAdmin/admin.sql new file mode 100755 index 0000000..6e95b1b --- /dev/null +++ b/wdpk/phpMyAdmin/admin.sql @@ -0,0 +1,4 @@ +CREATE USER admin@'localhost' IDENTIFIED BY 'admin'; +GRANT ALL ON *.* TO admin@'localhost' IDENTIFIED BY 'admin' WITH GRANT OPTION; +FLUSH PRIVILEGES; + diff --git a/wdpk/phpMyAdmin/apkg.rc b/wdpk/phpMyAdmin/apkg.rc new file mode 100755 index 0000000..c621291 --- /dev/null +++ b/wdpk/phpMyAdmin/apkg.rc @@ -0,0 +1,17 @@ +Package: phpMyAdmin +Packager: phpMyAdmin +Email: phpmyadmin-devel@lists.sourceforge.net +Homepage: http://www.phpmyadmin.net/home_page/index.php +AddonShowName: phpMyAdmin +AddonIndexPage: index.php +AddonUsedPort: 80 +InstDepend: +InstConflict: +StartDepend: +StartConflict: +Description: An open source, browser-based tool written in PHP that helps with the administration of MySQL and is often used as both an editor and administration assist tool for sites and some content management systems, such as WordPress. +Version: 1.04 +Icon: phpMyAdmin.png +MinFWVer: +MaxFWVer: +IndividualFlag: diff --git a/wdpk/phpMyAdmin/before_apkg.sh b/wdpk/phpMyAdmin/before_apkg.sh new file mode 100755 index 0000000..1c8e4d7 --- /dev/null +++ b/wdpk/phpMyAdmin/before_apkg.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +# DO NOT REMOVE!! diff --git a/wdpk/phpMyAdmin/build.sh b/wdpk/phpMyAdmin/build.sh new file mode 100755 index 0000000..81df9b9 --- /dev/null +++ b/wdpk/phpMyAdmin/build.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +APP_NAME="$(basename $(pwd))" +DATE="$(date +"%m%d%Y")" +CWD="$(pwd)" +VERSION="$(awk '/Version/{print $NF}' apkg.rc)" + +echo "Building ${APP_NAME} version ${VERSION}" + +MODELS="WDMyCloudEX4 WDMyCloudEX2 WDMyCloudMirror WDMyCloud WDMyCloudEX4100 WDMyCloudDL4100 WDMyCloudEX2100 WDMyCloudDL2100 WDMyCloudMirrorGen2 MyCloudEX2Ultra MyCloudPR4100 MyCloudPR2100" + +for model in $MODELS; do + ../../mksapkg -E -s -m $model > /dev/null +done + +echo "Move binaries" + +RELEASE_DIR="../../packages/${APP_NAME}" +mkdir -p "${RELEASE_DIR}" +find .. -maxdepth 1 -name "*.bin*" -exec rename 's#\('$DATE'\)##' {} \; +mv ../*.bin "${RELEASE_DIR}" + +echo "Bundle sources" +SRC_TAR="${RELEASE_DIR}/${APP_NAME}_src_${VERSION}.tar.gz" +tar -czf $SRC_TAR . + diff --git a/wdpk/phpMyAdmin/clean.sh b/wdpk/phpMyAdmin/clean.sh new file mode 100755 index 0000000..eeee031 --- /dev/null +++ b/wdpk/phpMyAdmin/clean.sh @@ -0,0 +1,7 @@ +#!/bin/sh +path=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin" + +# remove link +rm -rf ${APKG_WWW_DIR} 2> /dev/null + diff --git a/wdpk/phpMyAdmin/init.sh b/wdpk/phpMyAdmin/init.sh new file mode 100755 index 0000000..18091d4 --- /dev/null +++ b/wdpk/phpMyAdmin/init.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +path=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20-all-languages" +APKG_ICON_FILE_NAME="phpMyAdmin.png" +APKG_MULTI_LANG_DESC_XML="desc.xml" + +#remove link +rm -rf $APKG_WWW_DIR 2> /dev/null + +#create link +ln -sf $path/web/* ${APKG_WWW_DIR} + diff --git a/wdpk/phpMyAdmin/install.sh b/wdpk/phpMyAdmin/install.sh new file mode 100755 index 0000000..2e25c17 --- /dev/null +++ b/wdpk/phpMyAdmin/install.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +path_src=$1 +path_des=$2 + +APKG_WWW_DIR="/var/www/phpMyAdmin" +APKG_MODULE="phpMyAdmin" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20-all-languages" +ARCHIVE="${APKG_MODULE_WEB_DIR}.zip" +APKG_MODULE_SettingFile="config.inc.php" +APKG_PATH=${path_des}/${APKG_MODULE} +APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup + +mv $path_src/${APKG_MODULE} $path_des + +# setup secure downloads +if [ ! -e /etc/ssl/cert.pem ]; then + curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem + mv cacert.pem /etc/ssl/cert.pem +fi + +# download phpMyAdmin from the official website +cd ${APKG_PATH} +/usr/bin/wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/$ARCHIVE + +# extract +unzip $ARCHIVE +rm $ARCHIVE + +# restore config files if they are saved in preinst.sh (or before_apkg.sh) +if [ -d ${APKG_BACKUP_PATH} ] ; then + #copy setting file + cp -af ${APKG_BACKUP_PATH}/${APKG_MODULE_SettingFile} ${APKG_PATH}/${APKG_MODULE_WEB_DIR}/ + rm -rf ${APKG_BACKUP_PATH} +else + mysql --user=root --password=XP4VddgD0zd8IbKQ < $path_des/phpMyAdmin/admin.sql +fi diff --git a/wdpk/phpMyAdmin/preinst.sh b/wdpk/phpMyAdmin/preinst.sh new file mode 100755 index 0000000..082f931 --- /dev/null +++ b/wdpk/phpMyAdmin/preinst.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +path_src=$1 + +APKG_PATH=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin" +APKG_MODULE="phpMyAdmin" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20" +APKG_MODULE_SettingFile="config.inc.php" +APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup +#stop daemon + +#remove link +rm -rf $APKG_WWW_DIR 2> /dev/null + +# backup config files and users settings +if [ ! -d ${APKG_BACKUP_PATH} ] ; then + mkdir -p ${APKG_BACKUP_PATH} +fi +# copy config to tmp dir +cp -af $APKG_PATH/${APKG_MODULE_WEB_DIR}/${APKG_MODULE_SettingFile} ${APKG_BACKUP_PATH} + +#cmd on reinstall + +#copy file to installed directory + diff --git a/wdpk/phpMyAdmin/remove.sh b/wdpk/phpMyAdmin/remove.sh new file mode 100755 index 0000000..86a5093 --- /dev/null +++ b/wdpk/phpMyAdmin/remove.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +path=$1 +APKG_PATH=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin" +APKG_MODULE="phpMyAdmin" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20" +APKG_MODULE_SettingFile="config.inc.php" +APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup + +#stop daemon + +#remove link +rm -rf $APKG_WWW_DIR + +#remove mysql user +if [ ! -d ${APKG_BACKUP_PATH} ] ; then + mysql --user=root --password=XP4VddgD0zd8IbKQ < $path/del_admin.sql +fi + +#remove intstalled directory +rm -rf $path + diff --git a/wdpk/phpMyAdmin/start.sh b/wdpk/phpMyAdmin/start.sh new file mode 100755 index 0000000..9f5fff5 --- /dev/null +++ b/wdpk/phpMyAdmin/start.sh @@ -0,0 +1,10 @@ +#!/bin/sh +path=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin/" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20-all-languages" +#start daemon +rm -rf $APKG_WWW_DIR 2> /dev/null +ln -sf $path/$APKG_MODULE_WEB_DIR/* $APKG_WWW_DIR + +#cmd on start daemon + diff --git a/wdpk/phpMyAdmin/stop.sh b/wdpk/phpMyAdmin/stop.sh new file mode 100755 index 0000000..362cf8a --- /dev/null +++ b/wdpk/phpMyAdmin/stop.sh @@ -0,0 +1,13 @@ +#!/bin/sh +path=$1 +APKG_WWW_DIR="/var/www/phpMyAdmin" +APKG_MODULE_WEB_DIR="phpMyAdmin-4.0.10.20-all-languages" +APKG_ICON_FILE_NAME="phpMyAdmin.png" +APKG_MULTI_LANG_DESC_XML="desc.xml" + +# stop daemon +rm -rf $APKG_WWW_DIR + +# re-add the icon +mkdir ${APKG_WWW_DIR} +ln -s $path/web/* ${APKG_WWW_DIR} diff --git a/wdpk/phpMyAdmin/web/phpMyAdmin.png b/wdpk/phpMyAdmin/web/phpMyAdmin.png new file mode 100644 index 0000000..95c656e Binary files /dev/null and b/wdpk/phpMyAdmin/web/phpMyAdmin.png differ