2
0
mirror of https://github.com/meganz/MEGAcmd synced 2025-08-22 01:47:24 +00:00

Remove QNAP build directory

This commit is contained in:
Diego Ximenez 2025-02-05 13:04:35 +01:00
parent 2bb0b6d80b
commit b7ec964577
No known key found for this signature in database
GPG Key ID: 8E94095CB5DBCBA0
16 changed files with 0 additions and 668 deletions

View File

@ -1,38 +0,0 @@
# How to build MEGAcmd for QNAP NAS drives.
We follow the cross compiling system provided by QNAP, described at (https://www.qnap.com/event/dev/en/p_qdk.php#qdk_btn1_show)
Tested with ubuntu 16.04 as the build machine - others may work but that one does for sure.
There are two main steps. First, cross-compiling the executables, which can be done on Ubuntu 16.04 for example. Second, preparing a QNAP package including those binaries, which must be done on a QNAP NAS device.
# Cross-compiling
This example is for ARM, x86 and x86_64 will be similar.
Cross compiling machine requirements:
- **Most or all commands need to be run as 'sudo'**.
- dos2unix
- cross compiler from QNAP: install by following QNAP instructions to unzip one of these (available from qnap) in your `/opt/cross-project` folder
- `cross-project-arm-20110901.tar.gz` (for x19 platform) or
- `TS-x31+_cross-project-arm_al.20150909.tar.gz` (for x41+ platform)
Then copy or git clone the MEGAcmd project to /opt/cross-project/qnap/MEGAcmd. The sdk must be copied or cloned to the 'sdk' subfolder of that.
From the MEGAcmd folder, execute: <p>
`./build/QNAP/build-marvell` (for x19 ARM platform) <p>
`./build/QNAP/build-linaro` (for x41+ ARM platform) <p>
which will result in the binaries and scripts ending up in the MEGAcmd/install folder and being copied to the megacmdpkg folder ready to build the package.
# Building a QNAP package
This must be done on a QNAP NAS as it requires their QDK package. Download QDK_2.2.16.qpkg and use the QNAP package manager to manually install that.
Next, use `scp` or a similar tool to copy the MEGAcmd/build/QNAP_NAS/megacmdpkg folder to the NAS, followed by the contents of the MEGAcmd/install folder:
`scp -r build/QNAP_NAS/megacmdpkg admin@10.12.0.248:/share/CACHEDEV1_DATA/.qpkg/QDK/`
On the NAS, using ssh or similar, run the `qbuild` command from the megacmdpkg folder. The package will be built and put in the 'build' subfolder.

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
for architecture in arm x; do
for width in 32 64; do
platform=$architecture$width
result=OK
./build-$platform.sh &> $platform.log || result=FAIL
echo "$platform: $result"
done
done

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
export ARCH=arm
export BUILD_ARCH=32
export HOST=arm-linux-gnueabihf
export PATH=/opt/cross-project/arm/linaro/bin:$PATH
export ConfigOpt="--host $HOST"
export PLATFORM=arm-x41
source build-common.sh
build_all

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
export ARCH=aarch64
export BUILD_ARCH=64
export HOST=aarch64-QNAP-linux-gnu
export PATH=/opt/cross-project/$HOST/bin:$PATH
export ConfigOpt="--host $HOST"
export PLATFORM=arm_64
source build-common.sh
build_all

View File

@ -1,263 +0,0 @@
#!/usr/bin/env bash
build_all()
{
# Purge prior build artifacts.
clean || die "Couldn't remove prior build artifacts"
# Make sure AR, CC and friends are correctly set.
fix_environment
# Perform the build.
build_sdk || die "Couldn't build the SDK"
build_cmd || die "Couldn't build MEGAcmd"
# Package the build.
package || die "Unable to create package"
}
build_cmd()
{
local prefix="$PWD/sdk/sdk_build/install"
local flag_gtest="--with-gtest=$prefix"
local flag_freeimage="--with-freeimage=$prefix"
local flag_tests="--enable-tests"
local result=0
./autogen.sh
result=$?
if [ $result -ne 0 ]; then
return $result
fi
use_freeimage || flag_freeimage="--without-freeimage"
if ! use_gtest; then
flag_gtest="--without-gtest"
flag_tests="--disable-tests"
fi
env AR=$AR \
ARCH=$ARCH \
CC=$CC \
CFLAGS="$(compiler_flags $CFLAGS)" \
CPPFLAGS="$(preprocessor_flags $CFLAGS $CPPFLAGS)" \
CXX=$CXX \
CXXFLAGS="$(compiler_flags $CXXFLAGS)" \
LD=$LD \
NM=$NM \
OBJCXX=$CXX \
OBJDUMP=$OBJDUMP \
RANLIB=$RANLIB \
STRIP=$STRIP \
./configure $ConfigOpt \
--disable-curl-checks \
--disable-examples \
--disable-shared \
--enable-inotify \
--enable-static \
--enable-sync \
--with-cares="$prefix" \
--with-cryptopp="$prefix" \
--with-curl="$prefix" \
--with-libmediainfo="$prefix" \
--with-libuv="$prefix" \
--with-libzen="$prefix" \
--with-openssl="$prefix" \
--with-readline="$prefix" \
--with-sodium="$prefix" \
--with-sqlite="$prefix" \
--with-termcap="$prefix" \
--with-zlib="$prefix" \
--without-ffmpeg \
--without-libraw \
--without-pcre \
--without-pdfium \
$flag_gtest \
$flag_freeimage \
$flag_tests
result=$?
if [ $result -ne 0 ]; then
return $result
fi
make
result=$?
return $result
}
build_sdk()
{
local flag_configure_only="-c"
local flag_cross_compiling="-X"
local flag_disable_examples="-n"
local flag_disable_freeimage=""
local flag_enable_cares="-e"
local flag_enable_cryptopp="-q"
local flag_enable_curl="-g"
local flag_enable_megaapi="-a"
local flag_enable_readline="-R"
local flag_enable_sodium="-u"
local flag_enable_tests="-T"
local flag_enable_uv="-v"
local flag_openssl_assembly=""
local flag_openssl_compiler="linux-generic$BUILD_ARCH"
local result=0
pushd sdk || return
mkdir -p sdk_build/build || return
mkdir -p sdk_build/install/lib || return
use_assembly || flag_openssl_assembly="no-asm"
use_gtest || flag_enable_tests=""
use_freeimage || flag_disable_freeimage="-f"
env AR=$AR \
ARCH=$ARCH \
CC=$CC \
CFLAGS="$(compiler_flags $CFLAGS)" \
CPPFLAGS="$(preprocessor_flags $CFLAGS $CPPFLAGS)" \
CXX=$CXX \
CXXFLAGS="$(compiler_flags $CXXFLAGS)" \
LD=$LD \
NM=$NM \
OBJCXX=$CXX \
OBJDUMP=$OBJDUMP \
RANLIB=$RANLIB \
STRIP=$STRIP \
./contrib/build_sdk.sh -C "$ConfigOpt" \
-O "$flag_openssl_compiler" \
-S "$flag_openssl_assembly" \
$flag_configure_only \
$flag_cross_compiling \
$flag_disable_examples \
$flag_disable_freeimage \
$flag_enable_cares \
$flag_enable_cryptopp \
$flag_enable_curl \
$flag_enable_megaapi \
$flag_enable_readline \
$flag_enable_sodium \
$flag_enable_tests \
$flag_enable_uv
local result=$?
popd
return $result
}
clean()
{
if [ -f Makefile ]; then
make distclean || return
fi
rm -rf $(package_directory)
}
die()
{
echo "ERROR: $1"
exit 1
}
compiler_flags()
{
local result="$*"
# Strip preprocessor flags.
result="$(echo $result | sed -e 's/ *-[DI][^ ]\+//g')"
# Strip NEON flags (as it breaks freeimage.)
result="$(echo $result | sed -e 's/-mfpu=neon[^ ]*//g')"
# GCC's ARM ABI changed between 7.0 and 7.1.
result="$result -Wno-psabi"
echo "$result"
}
fix_environment()
{
export CC=$HOST-gcc
export CXX=$HOST-g++
for tool in ar ld nm ranlib strip; do
export ${tool^^}=$HOST-$tool
done
}
package()
{
directory=$(package_directory)
mkdir -p $directory || return
cp mega-cmd \
mega-cmd-server \
mega-exec \
src/client/mega-* \
$directory \
|| return
sed -i -e "s/^QPKG_VER=.*/QPKG_VER=\"$(version)\"/" \
$(package_root)/qpkg.cfg
}
package_directory()
{
echo "$(package_root)/$PLATFORM"
}
package_root()
{
echo build/QNAP_NAS/megacmdpkg
}
preprocessor_flags()
{
echo "$*" | grep -o -E -- '-[DI][^ ]+' | xargs
}
use_assembly()
{
test "$ARCH" != "x86_64"
}
use_gtest()
{
false
}
use_freeimage()
{
true
}
version()
{
major=$(version_component MAJOR)
minor=$(version_component MINOR)
micro=$(version_component MICRO)
echo "$major.$minor.$micro"
}
version_component()
{
sed -ne "s/.*$1_VERSION \([0-9]\+\).*/\1/p" \
src/megacmdversion.h
}
# Make sure we're at the root of the MEGAcmd source tree.
cd ../..

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
export ARCH=x86
export BUILD_ARCH=32
export HOST=i686-QNAP-linux-gnu
export PATH=/opt/cross-project/CT/$HOST/cross-tools/bin:$PATH
export ConfigOpt="--host $HOST"
export PLATFORM=$ARCH
source build-common.sh
build_all

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
export ARCH=x86_64
export BUILD_ARCH=64
export HOST=x86_64-QNAP-linux-gnu
export PATH=/opt/cross-project/CT/$HOST/cross-tools/bin:$PATH
export ConfigOpt="--host $HOST"
export PLATFORM=$ARCH
source build-common.sh
build_all

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,141 +0,0 @@
######################################################################
# List of available definitions (it's not necessary to uncomment them)
######################################################################
###### Command definitions #####
#CMD_AWK="/bin/awk"
#CMD_CAT="/bin/cat"
#CMD_CHMOD="/bin/chmod"
#CMD_CHOWN="/bin/chown"
#CMD_CP="/bin/cp"
#CMD_CUT="/bin/cut"
#CMD_DATE="/bin/date"
#CMD_ECHO="/bin/echo"
#CMD_EXPR="/usr/bin/expr"
#CMD_FIND="/usr/bin/find"
#CMD_GETCFG="/sbin/getcfg"
#CMD_GREP="/bin/grep"
#CMD_GZIP="/bin/gzip"
#CMD_HOSTNAME="/bin/hostname"
#CMD_LN="/bin/ln"
#CMD_LOG_TOOL="/sbin/log_tool"
#CMD_MD5SUM="/bin/md5sum"
#CMD_MKDIR="/bin/mkdir"
#CMD_MV="/bin/mv"
#CMD_RM="/bin/rm"
#CMD_RMDIR="/bin/rmdir"
#CMD_SED="/bin/sed"
#CMD_SETCFG="/sbin/setcfg"
#CMD_SLEEP="/bin/sleep"
#CMD_SORT="/usr/bin/sort"
#CMD_SYNC="/bin/sync"
#CMD_TAR="/bin/tar"
#CMD_TOUCH="/bin/touch"
#CMD_WGET="/usr/bin/wget"
#CMD_WLOG="/sbin/write_log"
#CMD_XARGS="/usr/bin/xargs"
#CMD_7Z="/usr/local/sbin/7z"
#
###### System definitions #####
#SYS_EXTRACT_DIR="$(pwd)"
#SYS_CONFIG_DIR="/etc/config"
#SYS_INIT_DIR="/etc/init.d"
#SYS_STARTUP_DIR="/etc/rcS.d"
#SYS_SHUTDOWN_DIR="/etc/rcK.d"
#SYS_RSS_IMG_DIR="/home/httpd/RSS/images"
#SYS_QPKG_DATA_FILE_GZIP="./data.tar.gz"
#SYS_QPKG_DATA_FILE_BZIP2="./data.tar.bz2"
#SYS_QPKG_DATA_FILE_7ZIP="./data.tar.7z"
#SYS_QPKG_DATA_CONFIG_FILE="./conf.tar.gz"
#SYS_QPKG_DATA_MD5SUM_FILE="./md5sum"
#SYS_QPKG_DATA_PACKAGES_FILE="./Packages.gz"
#SYS_QPKG_CONFIG_FILE="$SYS_CONFIG_DIR/qpkg.conf"
#SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File"
#SYS_QPKG_CONF_FIELD_NAME="Name"
#SYS_QPKG_CONF_FIELD_VERSION="Version"
#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_SERVICE_PIDFILE="Pid_File"
#SYS_QPKG_CONF_FIELD_AUTHOR="Author"
#SYS_QPKG_CONF_FIELD_RC_NUMBER="RC_Number"
## The following variables are assigned values at run-time.
#SYS_HOSTNAME=$($CMD_HOSTNAME)
## Data file name (one of SYS_QPKG_DATA_FILE_GZIP, SYS_QPKG_DATA_FILE_BZIP2,
## or SYS_QPKG_DATA_FILE_7ZIP)
#SYS_QPKG_DATA_FILE=
## Base location.
#SYS_QPKG_BASE=""
## Base location of QPKG installed packages.
#SYS_QPKG_INSTALL_PATH=""
## Location of installed software.
#SYS_QPKG_DIR=""
## If the QPKG should be enabled or disabled after the installation/upgrade.
#SYS_QPKG_SERVICE_ENABLED=""
## Architecture of the device the QPKG is installed on.
#SYS_CPU_ARCH=""
## Name and location of system shares
#SYS_PUBLIC_SHARE=""
#SYS_PUBLIC_PATH=""
#SYS_DOWNLOAD_SHARE=""
#SYS_DOWNLOAD_PATH=""
#SYS_MULTIMEDIA_SHARE=""
#SYS_MULTIMEDIA_PATH=""
#SYS_RECORDINGS_SHARE=""
#SYS_RECORDINGS_PATH=""
#SYS_USB_SHARE=""
#SYS_USB_PATH=""
#SYS_WEB_SHARE=""
#SYS_WEB_PATH=""
## Path to ipkg or opkg package tool if installed.
#CMD_PKG_TOOL=
#
######################################################################
# All package specific functions shall call 'err_log MSG' if an error
# is detected that shall terminate the installation.
######################################################################
#
######################################################################
# Define any package specific operations that shall be performed when
# the package is removed.
######################################################################
#PKG_PRE_REMOVE="{
#}"
#
#PKG_MAIN_REMOVE="{
#}"
#
#PKG_POST_REMOVE="{
#}"
#
######################################################################
# Define any package specific initialization that shall be performed
# before the package is installed.
######################################################################
#pkg_init(){
#}
#
######################################################################
# Define any package specific requirement checks that shall be
# performed before the package is installed.
######################################################################
#pkg_check_requirement(){
#}
#
######################################################################
# Define any package specific operations that shall be performed when
# the package is installed.
######################################################################
#pkg_pre_install(){
#}
#
#pkg_install(){
#}
pkg_post_install(){
/usr/sbin/dbus-uuidgen --ensure=/etc/machine-id
}

View File

@ -1,2 +0,0 @@
#!/bin/sh
exit 0

View File

@ -1,29 +0,0 @@
# Name of the packaged application.
QPKG_NAME="MEGAcmd"
# Name of the display application.
QPKG_DISPLAY_NAME="MEGAcmd"
# Version of the packaged application.
QPKG_VER="2.0.0"
# Author or maintainer of the package
QPKG_AUTHOR="Mega.nz"
# One-line description of the packaged application
QPKG_SUMMARY="Synchronise or backup your NAS folders to Mega.nz"
# Preferred number in start/stop sequence.
QPKG_RC_NUM="101"
# Init-script used to control the start and stop of the installed application.
QPKG_SERVICE_PROGRAM="MEGAcmd.sh"
# Relative path to web interface
QPKG_WEBUI="/MEGAcmd/"
# Port number for the web interface.
QPKG_WEB_PORT="-1"
#Desktop Application (since 4.1)
# Set value to 1 means to open the QPKG's Web UI inside QTS desktop instead of new window.
QPKG_DESKTOP_APP="1"
# Min/Max QTS version requirement
QTS_MINI_VERSION="4.3.6"
QTS_MAX_VERSION="6.0.0"

View File

@ -1,56 +0,0 @@
#!/bin/sh
service_start()
{
web_config_add
web_config_reload
}
service_stop()
{
web_config_remove
web_config_reload
}
web_config_add()
{
local getcfg="/sbin/getcfg"
local name="MEGAcmd"
local conf="/etc/config/qpkg.conf"
local root="$($getcfg $name Install_Path -f $conf)"
ln -sf $root /home/httpd/cgi-bin/qpkg
ln -sf $root/web/apache-megacmd.conf /etc/default_config/apache/extra
}
web_config_reload()
{
/etc/init.d/thttpd.sh reload
/etc/init.d/stunnel.sh reload
}
web_config_remove()
{
rm -f /etc/default_config/apache/extra/apache-megacmd.conf
rm -f /home/httpd/cgi-bin/qpkg/MEGAcmd
}
case "$1" in
start)
service_start
;;
stop)
service_stop
;;
restart)
service_stop
service_start
;;
*)
echo "Usage: $@ {start|stop|restart}"
exit 1
;;
esac
exit 0

View File

@ -1,7 +0,0 @@
<IfModule alias_module>
Alias /cgi-bin/MEGAcmd "/home/httpd/cgi-bin/qpkg/MEGAcmd/web"
Alias /MEGAcmd "/home/httpd/cgi-bin/qpkg/MEGAcmd/web"
ProxyPass /MEGAcmd !
ProxyPass /cgi-bin/MEGAcmd !
</IfModule>

View File

@ -1,72 +0,0 @@
<html>
<head>
<title>Welcome to MEGAcmd</title>
<link rel="icon" href="https://mega.nz/favicon.ico?v=3" type="image/x-icon" />
</head>
<body>
MEGAcmd is a command line tool. Now that it is installed, please connect to your QNAP NAS drive with ssh, PuTTY, or similar. The executables are at %%%.
In order for the scripts to work, please add that path to your PATH. Please refer to the built-in help or to the <a href="https://github.com/meganz/MEGAcmd/blob/master/UserGuide.md" target="_blank">User Guide</a>.
<p>
Here is an example session:
<p>
<tt>
<PRE>
login as: admin
admin@10.12.0.248's password:
[~] # export PATH=/share/CACHEDEV1_DATA/.qpkg/MEGAcmd:$PATH
[~] # mega-cmd
.=============================================================================.
| __ __ _____ ____ _ _ |
| | \/ | ___|/ ___| / \ ___ _ __ ___ __| | |
| | |\/| | \ / | _ / _ \ / __| '_ ` _ \ / _` | |
| | | | | /__\ |_| |/ ___ \ (__| | | | | | (_| | |
| |_| |_|____|\____/_/ \_\___|_| |_| |_|\__,_| |
| |
| Welcome to MEGAcmd! A Command Line Interactive and Scriptable |
| Application to interact with your MEGA account |
| This is a BETA version, it might not be bug-free. |
| Also, the signature/output of the commands may change in a future. |
| Please write to support@mega.nz if you find any issue or |
| have any suggestion concerning its functionalities. |
| Enter "help --non-interactive" to learn how to use MEGAcmd with scripts. |
| Enter "help" for basic info and a list of available commands. |
`=============================================================================&#180;
[Initiating server in background. Log: /root/.megaCmd/megacmdserver.log]
MEGA CMD&gt; help
Here is the list of available commands and their usage
Use "help -f" to get a brief description of the commands
You can get further help on a specific command with "command" --help
Alternatively, you can use "help" -ff to get a complete description of all commands
Use "help --non-interactive" to learn how to use MEGAcmd with scripts
Use "help --upgrade" to learn about the limitations and obtaining PRO accounts
Commands:
attr graphics preview
backup help put
cancel https pwd
cd import quit
clear invite reload
completion ipc rm
confirm killsession session
confirmcancel lcd share
cp log showpcr
debug login signup
deleteversions logout speedlimit
du lpwd sync
errorcode ls thumbnail
exclude masterkey transfers
exit mkdir userattr
export mount users
find mv version
ftp passwd webdav
get permissions whoami
Verbosity: You can increase the amount of information given by any command by passing "-v" ("-vv", "-vvv", ...)
MEGA CMD&gt;
</PRE>
</tt>
</body>
</html>