├── 7z.dll ├── 7z.exe ├── INFO ├── LICENSE ├── Mods.exe ├── PACKAGE_ICON.PNG ├── PACKAGE_ICON_256.PNG ├── Pack.cmd ├── PackageManager.spk ├── README.md ├── Unpack.cmd ├── package └── ui │ ├── config │ ├── dsm.cgi.conf │ ├── favicon.png │ ├── images │ ├── Package_Manager_128.png │ ├── Package_Manager_16.png │ ├── Package_Manager_24.png │ ├── Package_Manager_256.png │ ├── Package_Manager_32.png │ ├── Package_Manager_48.png │ ├── Package_Manager_64.png │ ├── Package_Manager_72.png │ └── Package_Manager_96.png │ ├── mvpkg.php │ ├── mvpkg.sh │ ├── rmpkg.sh │ ├── router.cgi │ └── spin.min.js ├── screen_1.png └── scripts ├── postinst ├── postuninst ├── postupgrade ├── preinst ├── preuninst ├── preupgrade └── start-stop-status /7z.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/7z.dll -------------------------------------------------------------------------------- /7z.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/7z.exe -------------------------------------------------------------------------------- /INFO: -------------------------------------------------------------------------------- 1 | arch="noarch" 2 | beta="no" 3 | changelog="Upgraded to run with php7.3" 4 | checksum="19c33ef9e813ce241bd783967e08f371" 5 | ctl_stop="yes" 6 | ctl_uninstall="yes" 7 | description="Simple application to move packages from a volume to another or to erase them without taking care of dependencies, if any." 8 | description_chs="一个简单的应用程序,用于将程序包从一个卷移动到另一个卷或删除它们而无需考虑依赖关系(如果有)。" 9 | description_cht="一個簡單的應用程序,用於將程序包從一個卷移動到另一個卷或刪除它們而無需考慮依賴關係(如果有)。" 10 | description_enu="Simple application to move packages from a volume to another or to erase them without taking care of dependencies, if any." 11 | displayname="MODS Package Manager" 12 | displayname_chs="套件管理器" 13 | displayname_cht="套件管理器" 14 | displayname_enu="MODS Package Manager" 15 | distributor="owen" 16 | distributor_url="http://www.iowen.cn" 17 | dsmappname="SYNO.SDS._ThirdParty.App.MODS_PackageManager" 18 | dsmuidir="ui" 19 | firmware="6.0-7321" 20 | helpurl="https://github.com/vletroye/SynoPackages/wiki/MODS-Package-Manager" 21 | install_dep_packages="PHP7.3" 22 | install_reboot="no" 23 | instuninst_restart_services="nginx" 24 | maintainer="vletroye" 25 | maintainer_url="http://www.beatificabytes.be" 26 | offline_install="no" 27 | os_min_ver="6.0-7321" 28 | package="MODS_PackageManager" 29 | precheckstartstop="yes" 30 | reloadui="yes" 31 | report_url="https://mods.codeplex.com/discussions" 32 | silent_install="yes" 33 | silent_uninstall="yes" 34 | silent_upgrade="yes" 35 | singleApp="yes" 36 | startable="yes" 37 | startstop_restart_services="nginx" 38 | support_center="no" 39 | support_url="https://github.com/vletroye/SynoPackages/issues" 40 | thirdparty="yes" 41 | version="0.0-0084" 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." 2 | 3 | THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. 4 | There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. 5 | You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT. 6 | -------------------------------------------------------------------------------- /Mods.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/Mods.exe -------------------------------------------------------------------------------- /PACKAGE_ICON.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/PACKAGE_ICON.PNG -------------------------------------------------------------------------------- /PACKAGE_ICON_256.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/PACKAGE_ICON_256.PNG -------------------------------------------------------------------------------- /Pack.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd /d %~dp0 3 | 4 | if exist mods.spk (del mods.spk) 5 | cd package 6 | "..\7z.exe" a -ttar -so "..\package" * -xr!*.git -xr!*.gitignore | "..\7z.exe" a -si package.tgz 7 | if errorlevel 1 ( 8 | cd .. 9 | echo Error while archiving package. 10 | exit /b 2 11 | ) 12 | move package.tgz ..\ 13 | cd .. 14 | Mods.exe hash:. 15 | 7z.exe a -ttar mods.spk package.tgz scripts WIZARD_UIFILES CHANGELOG INFO LICENSE PACKAGE_ICON*.PNG screen_*.png 16 | if errorlevel 1 ( 17 | cd .. 18 | echo Error while creating package. 19 | exit /b 2 20 | ) 21 | del package.tgz -------------------------------------------------------------------------------- /PackageManager.spk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/PackageManager.spk -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 套件管理器 2 | 一个简单的应用程序,用于将程序包从一个卷移动到另一个卷或删除它们而无需考虑依赖关系(如果有)。 3 |
4 | 5 | ![Thumbnail_index](https://github.com/owen0o0/PackageManager/blob/master/screen_1.png) 6 |
7 | 8 | ### 功能 9 | + 将程序包从一个卷移动到另一个卷 10 | + 删除它们而无需考虑依赖关系 11 |
12 | 13 | ### 使用 14 | 下载后在群晖套件中心手动安装 PackageManager.spk 软件包 15 |
16 | 17 | ### 感谢 18 | 感谢 vletroye 19 |
-------------------------------------------------------------------------------- /Unpack.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd /d %~dp0 3 | 4 | for %%a in (./*.spk) do set spk=%%~na 5 | echo %spk% 6 | 7 | echo Extract SPK 8 | echo ----------- 9 | echo. 10 | 7z.exe x -aoa -ttar %spk%.spk 11 | if errorlevel 1 ( 12 | echo Error extracting spk. 13 | exit /b 2 14 | ) 15 | 16 | echo Extract TGZ 17 | echo ----------- 18 | echo. 19 | 7z.exe x package.tgz -so | 7z.exe x -aoa -si -ttar -opackage 20 | if errorlevel 1 ( 21 | echo Error while extracting package. 22 | exit /b 2 23 | ) 24 | del package.tgz -------------------------------------------------------------------------------- /package/ui/config: -------------------------------------------------------------------------------- 1 | { 2 | ".url": { 3 | "SYNO.SDS._ThirdParty.App.MODS_PackageManager.Package_Manager": { 4 | "itemType": 2, 5 | "type": "legacy", 6 | "allUsers": false, 7 | "title": "Package Manager", 8 | "desc": "Simple application to move packages from a volume to another - or - to erase them.", 9 | "icon": "images/Package_Manager_{0}.png", 10 | "url": "/webman/3rdparty/MODS_PackageManager/mvpkg.php", 11 | "allowMultiInstance": false, 12 | "configablePrivilege": false, 13 | "advanceGrantPrivilege": false, 14 | "grantPrivilege": "", 15 | "width": 0, 16 | "height": 0 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /package/ui/dsm.cgi.conf: -------------------------------------------------------------------------------- 1 | location ~ ^/webman/3rdparty/@MODS_CGI@/.*\.php { 2 | root /usr/syno/synoman; 3 | include scgi_params; 4 | rewrite .*\.php /webman/3rdparty/@MODS_CGI@/router.cgi break; 5 | scgi_pass synoscgi; 6 | } -------------------------------------------------------------------------------- /package/ui/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/favicon.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_128.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_16.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_24.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_256.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_32.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_48.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_64.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_72.png -------------------------------------------------------------------------------- /package/ui/images/Package_Manager_96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/PackageManager/c1ecc2ad7fd32fb4f56594e7678aded4bcabc0b5/package/ui/images/Package_Manager_96.png -------------------------------------------------------------------------------- /package/ui/mvpkg.php: -------------------------------------------------------------------------------- 1 | &1"; 15 | break; 16 | case "stop": 17 | $action = "sudo /usr/syno/sbin/synoservicecfg --hard-stop 'pkgctl-$PACKAGE' 2>&1"; 18 | break; 19 | case "reverse": 20 | $action = "sudo /usr/syno/sbin/synoservicecfg --reverse-dependency 'pkgctl-$PACKAGE' 2>&1"; 21 | $dep = "sudo /usr/syno/sbin/synoservicecfg --reverse-dependency 'pkgctl-$PACKAGE'"; 22 | break; 23 | case "forward": 24 | $action = "sudo /usr/syno/sbin/synoservicecfg --forward-dependency 'pkgctl-$PACKAGE' 2>&1"; 25 | $dep = "sudo /usr/syno/sbin/synoservicecfg --forward-dependency 'pkgctl-$PACKAGE'"; 26 | break; 27 | case "erase": 28 | $action = "sudo ".dirname(__FILE__)."/rmpkg.sh '$PACKAGE' 2>&1"; 29 | $TARGET = ""; 30 | $PACKAGE = ""; 31 | break; 32 | default: 33 | $action = "sudo ".dirname(__FILE__)."/mvpkg.sh '$TARGET' '$PACKAGE' 2>&1"; 34 | $TARGET = ""; 35 | $PACKAGE = ""; 36 | } 37 | } 38 | 39 | if ($action != '') { 40 | //ob_start(); 41 | //passthru($move); 42 | //$output = ob_get_clean(); 43 | exec($action, $output, $result); 44 | } 45 | ?> 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 236 | 317 | 318 | (\\/(volume\\d+)\\/@appstore\\/\\2)/', $package, $out) ) { 325 | $link = $out[1]; 326 | $name = $out[2]; 327 | $path = $out[3]; 328 | $volume = $out[4]; 329 | $arr[$name] = [$volume, $path, $link]; 330 | 331 | $usedVolumes[$volume] = $volume; 332 | } 333 | } 334 | 335 | if ($dep != '') { 336 | $dependencies = shell_exec($dep); 337 | //Test: $dependencies = "service [pkgctl-WebStation] is depended by service [pkgctl-Apache2.4] [pkgctl-WordPress] [pkgctl-Apache2.2] [pkgctl-phpMyAdmin] (list by disable order)"; 338 | foreach(explode(" ", $dependencies) as $dependency){ 339 | $out = null; 340 | if ( preg_match('/\[pkgctl-(.*)\]/', $dependency, $out) ) { 341 | $elem = $out[1]; 342 | $dependent[$elem] = 1; 343 | } 344 | } 345 | } 346 | 347 | #Get list of volumes 348 | $volumeNames = shell_exec('df -la --output=target | grep volume'); 349 | 350 | foreach(preg_split("/((\r?\n)|(\r\n?))/", $volumeNames) as $volumeName){ 351 | $out = null; 352 | if ( preg_match('/volume\\d+/', $volumeName, $out) ) { 353 | $volume = $out[0]; 354 | $volumes[$volume] = $volume; 355 | } 356 | } 357 | 358 | #Get Packages status 359 | $statusList = shell_exec('sudo /usr/syno/sbin/synoservicecfg --status'); 360 | 361 | //Test: $statusList = " 362 | // Service [pkgctl-Init_3rdparty] status=[enable] 363 | // required upstart job: 364 | // [pkgctl-Init_3rdparty] is start. 365 | // ======================================= 366 | // Service [pkgctl-PkgMover] status=[enable] 367 | // required upstart job: 368 | // [pkgctl-PkgMover] is start. 369 | // ======================================= 370 | // Service [pkgctl-filebot-node] status=[enable] 371 | // required upstart job: 372 | // [pkgctl-filebot-node] is start. 373 | // ======================================= 374 | // Service [pkgctl-NoteStation] status=[enable] 375 | // required upstart job: 376 | // [pkgctl-NoteStation] is start. 377 | // ======================================="; 378 | 379 | foreach(preg_split("/((\r?\n)|(\r\n?))/", $statusList) as $status){ 380 | $out = null; 381 | if ( preg_match('/\[pkgctl-(.*)\] status=\[(.*)\]/', $status, $out) ) { 382 | $service = $out[1]; 383 | $serviceStatus = $out[2]; 384 | $PackageStatus[$service] = $serviceStatus; 385 | } 386 | } 387 | 388 | uksort($usedVolumes, "strnatcasecmp"); 389 | uksort($volumes, "strnatcasecmp"); 390 | uksort($arr, "strnatcasecmp"); 391 | 392 | foreach ($usedVolumes as $key => $volume){ 393 | echo "
在 $volume 中的套件"; 394 | $col = 1; 395 | echo ""; 396 | foreach ($arr as $package => $data){ 397 | if ($data[0] == $volume) { 398 | //$cmd = "/usr/syno/sbin/synoservicectl --status 'pkgctl-$package'"; 399 | //$state = shell_exec($cmd); 400 | 401 | echo ""; 415 | $col = $col +1; 416 | if ($col % 5 == 0) { 417 | $col = 1; 418 | echo "\n"; 419 | } 420 | } 421 | } 422 | echo "
"; 405 | else 406 | echo " style='color:black'>"; 407 | } else { 408 | if ($dependent[$package] == 1) 409 | echo " style='color:rgb(189,189,189);text-decoration:underline'>"; 410 | else 411 | echo " style='color:rgb(189,189,189)'>"; 412 | } 413 | echo $package; 414 | echo "
"; 423 | echo "
灰显的套件表示被禁用
"; 424 | echo "
"; 425 | } 426 | 427 | echo "


\n"; 428 | //echo "
\n"; 429 | 430 | echo "
"; 431 | echo "
选择要移动的套件\n"; 432 | echo "

"; 433 | echo ""; 434 | foreach ($arr as $package => $data){ 435 | echo "\n"; 438 | echo "

\n"; 439 | echo "
\n"; 440 | 441 | 442 | echo "
目标存储空间"; 443 | echo "

"; 444 | echo ""; 445 | foreach ($volumes as $key => $volume){ 446 | echo ""; 449 | echo "

"; 450 | echo "
"; 451 | echo "

"; 452 | echo " "; 453 | echo " "; 454 | echo " \n"; 455 | echo " \n"; 456 | echo " \n"; 457 | echo " \n"; 458 | echo " \n"; 459 | //echo "
\n"; 460 | if ($action != '') { 461 | 462 | echo "
信息"; 463 | foreach ($output as $item => $data){ 464 | echo "

$data

"; 465 | } 466 | echo "
"; 467 | } 468 | ob_end_flush(); 469 | ?> 470 |
471 |
472 |

473 | 移动套件... 474 |

475 |
476 |
477 | 478 | -------------------------------------------------------------------------------- /package/ui/mvpkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TARGET=$1 4 | PACKAGE=$2 5 | 6 | if [[ $PACKAGE == "" ]] 7 | then 8 | echo "Usage: mvpkg Target Package" 9 | echo " Target must be like 'volumex' where x is a numeric." 10 | echo " Package must be the name of a package." 11 | exit 12 | fi 13 | 14 | if [[ $TARGET != volume[0-9]* ]] 15 | then 16 | echo "Usage: mvpkg Target Package" 17 | echo " Target must be like 'volumex' where x is a numeric." 18 | echo " Package [$PACKAGE] must be the name of a package." 19 | exit 20 | fi 21 | 22 | #Check the package and check the result: "enable" (is start), "disable" (is stop) or "does not exist" 23 | output=$(/usr/syno/sbin/synoservicecfg --status "pkgctl-$PACKAGE" | grep Service) 24 | 25 | if [[ $output == *"does not exist"* ]] 26 | then 27 | echo "套件 $PACKAGE 找不到" 28 | exit 29 | else 30 | #find the current volume of the package and its link 31 | output=$( ls -la /var/packages/*/target | grep "/$PACKAGE/") 32 | 33 | link=$(echo $output | grep -oP "\/var/packages/.*/target") 34 | volume=$(echo $output | grep -oP "volume\d*") 35 | path=$(echo $output | grep -oP "\/volume.*") 36 | 37 | if [[ $link != "/var/packages/$PACKAGE/target"* ]] 38 | then 39 | echo "套件 $PACKAGE 没有正确安装。" 40 | exit 41 | fi 42 | 43 | if [[ $volume != "volume"* ]] 44 | then 45 | echo "套件 $PACKAGE 找不到" 46 | exit 47 | fi 48 | 49 | if [[ $volume == $TARGET ]] 50 | then 51 | echo "套件 $PACKAGE 已在 $TARGET 上." 52 | exit 53 | fi 54 | 55 | if [[ "$path" != "/$volume/@appstore/$PACKAGE" ]] 56 | then 57 | echo "套件 $PACKAGE 没有一个标准位置。" 58 | exit 59 | fi 60 | 61 | #List Packages with dependency on this one 62 | #/usr/syno/sbin/synoservicecfg --reverse-dependency pkgctl-$PACKAGE 63 | 64 | #Stop the package and all its dependencies 65 | output=$(/usr/syno/sbin/synoservicecfg --hard-stop "pkgctl-$PACKAGE" | grep warn) 66 | 67 | if [[ $output != *"have been set"* ]] 68 | then 69 | echo "套件 $PACKAGE 无法停用。" 70 | exit 71 | fi 72 | 73 | if [ -d "/$TARGET/@appstore/$PACKAGE" ]; then 74 | mv "/$TARGET/@appstore/$PACKAGE" "/$TARGET/@appstore/$PACKAGE-$(date -d "today" +"%Y%m%d%H%M").log" 75 | fi 76 | 77 | #remove the link on the previous volume 78 | rm -f "$link" 79 | 80 | #move the package 81 | mv "$path" /$TARGET/@appstore 82 | 83 | #link with the package on the new volume 84 | ln -s "/$TARGET/@appstore/$PACKAGE" "$link" 85 | 86 | #Replace link also in local 87 | local="/usr/local/$PACKAGE" 88 | if [ -L "$local" ]; then 89 | rm -f "$local" 90 | ln -s "/$TARGET/@appstore/$PACKAGE" "$local" 91 | fi 92 | 93 | #update settings 94 | sed -i "s/$volume/$TARGET/" "/usr/syno/etc/packages/$PACKAGE/*" &>/dev/null 95 | 96 | #Restart packages depending on the one moved 97 | output=$(/usr/syno/sbin/synoservicecfg --reverse-dependency "pkgctl-$PACKAGE") 98 | 99 | output="$(echo $output | grep -Po "pkgctl-([^\]]*)")" 100 | for string in $output 101 | do 102 | /usr/syno/sbin/synoservicecfg --start "$string" 103 | done 104 | 105 | #Restart the package and all its dependencies 106 | output=$(/usr/syno/sbin/synoservicecfg --hard-start "pkgctl-$PACKAGE" | grep Service) 107 | 108 | #Check if the package has been correctly restarted 109 | output=$(/usr/syno/sbin/synoservicecfg --is-enabled "pkgctl-$PACKAGE") 110 | 111 | if [[ $output != *"is enabled"* ]] 112 | then 113 | echo "套件 $PACKAGE 从 $volume 移至 $TARGET 后无法正确重启." 114 | else 115 | echo "套件 $PACKAGE 已成功从 $volume 移至 $TARGET." 116 | fi 117 | fi 118 | -------------------------------------------------------------------------------- /package/ui/rmpkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PACKAGE=$1 4 | 5 | if [[ $PACKAGE == "" ]] 6 | then 7 | echo "Usage: rmpkg Package" 8 | echo " Package must be the name of a package." 9 | exit 10 | fi 11 | 12 | #Check the package and check the result: "enable" (is start), "disable" (is stop) or "does not exist" 13 | output=$(/usr/syno/sbin/synoservicecfg --status "pkgctl-$PACKAGE" | grep Service) 14 | 15 | if [[ $output == *"does not exist"* ]] 16 | then 17 | echo "套件 $PACKAGE 找不到." 18 | exit 19 | else 20 | #Stop the package and all its dependencies 21 | output=$(/usr/syno/sbin/synoservicecfg --hard-stop "pkgctl-$PACKAGE" | grep warn) 22 | 23 | if [[ $output != *"have been set"* ]] 24 | then 25 | echo "The service $PACKAGE couldn't be stopped. A dirty delete is going to be executed." 26 | #exit 27 | fi 28 | 29 | #find the current volume of the package and its link 30 | output=$( ls -la /var/packages/*/target | grep "/$PACKAGE/") 31 | 32 | volume=$(echo $output | grep -oP "volume\d*") 33 | path=$(echo $output | grep -oP "\/volume.*") 34 | 35 | local="/usr/syno/synoman/webman/3rdparty/$PACKAGE" 36 | if [ -L "$local" ]; then 37 | rm -f "$local" 38 | fi 39 | 40 | if [[ "$path" == "/$volume/@appstore/$PACKAGE" ]] 41 | then 42 | if [ -d "$path" ]; then 43 | rm -R "$path" 44 | fi 45 | fi 46 | 47 | path="/var/packages/$PACKAGE" 48 | if [ -d "$path" ]; then 49 | rm -R "$path" 50 | fi 51 | 52 | path="/usr/syno/etc/packages/$PACKAGE" 53 | if [ -d "$path" ]; then 54 | rm -R "$path" 55 | fi 56 | 57 | local="/usr/local/$PACKAGE" 58 | if [ -L "$local" ]; then 59 | rm -f "$local" 60 | fi 61 | fi 62 | -------------------------------------------------------------------------------- /package/ui/router.cgi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #LOG="/var/log/@SYNOPKG_PKGNAME@" 4 | 5 | # the web server account (Ex.: http) must be granted write access 6 | if [ -w $LOG ]; then 7 | echo `date` "------------------------------------------------------------------" >> $LOG 8 | echo `date` "ROUTER.cgi has been called" >> $LOG 9 | echo `date` "HANDLING request for" $REQUEST_URI >> $LOG 10 | 11 | # Log all environment variables if the Query String contains 'LogRouterCgi' 12 | if [[ $QUERY_STRING = *"LogRouterCgi"* ]]; then 13 | printenv >> $LOG 14 | fi 15 | fi 16 | 17 | if [ "$REQUEST_URI" == "$SCRIPT_NAME" ]; then 18 | if [ -w $LOG ]; then 19 | echo `date` "NO REQUEST:" $SCRIPT_NAME >> $LOG 20 | fi 21 | #echo "Content-type: text/html" 22 | echo -e "HTTP/1.1 200 OK\n\n" 23 | else 24 | 25 | # Set redirect_status to 1 to get php cgi working. 26 | REDIRECT_STATUS=1 export REDIRECT_STATUS 27 | 28 | # Fix several $_SERVER globals. 29 | PHP_SELF=$REQUEST_URI export PHP_SELF 30 | SCRIPT_NAME=$REQUEST_URI export SCRIPT_NAME 31 | 32 | # Generate the request url without the Query String parameters 33 | SCRIPT_FILENAME=$DOCUMENT_ROOT${REQUEST_URI%\?$QUERY_STRING} 34 | if [ -w $LOG ]; then 35 | echo `date` "SCRIPT_FILENAME:" $SCRIPT_FILENAME >> $LOG 36 | fi 37 | 38 | # Prepare the Query String parameters 39 | SCRIPT_PARAMETERS=${QUERY_STRING//[&]/ } 40 | if [ -w $LOG ]; then 41 | echo `date` "SCRIPT_PARAMETERS:" $SCRIPT_PARAMETERS >> $LOG 42 | fi 43 | 44 | SCRIPT_FILENAME=`realpath $SCRIPT_FILENAME` export SCRIPT_FILENAME 45 | if [ -w $LOG ]; then 46 | echo `date` "REALPATH:" $SCRIPT_FILENAME >> $LOG 47 | fi 48 | 49 | if [ -w $LOG ]; then 50 | #echo `date` "EXECUTE:" "/usr/local/bin/php56-cgi -c /etc/php/php.ini -d open_basedir=none "$SCRIPT_FILENAME" "$SCRIPT_PARAMETERS" 2>&1" >> $LOG 51 | echo `date` "EXECUTE:" "/usr/local/bin/php73-cgi -c /usr/local/etc/php73/cli/php.ini -d open_basedir=none "$SCRIPT_FILENAME" "$SCRIPT_PARAMETERS" 2>&1" >> $LOG 52 | fi 53 | #/usr/local/bin/php56-cgi -c /etc/php/php.ini -d open_basedir=none $SCRIPT_FILENAME $SCRIPT_PARAMETERS 2>&1 54 | /usr/local/bin/php73-cgi -c /usr/local/etc/php73/cli/php.ini -d open_basedir=none $SCRIPT_FILENAME $SCRIPT_PARAMETERS 2>&1 55 | fi -------------------------------------------------------------------------------- /package/ui/spin.min.js: -------------------------------------------------------------------------------- 1 | // http://spin.js.org/#v2.3.2 2 | !function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;if(b=b.charAt(0).toUpperCase()+b.slice(1),void 0!==e[b])return b;for(d=0;d',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k> $LOG 4 | 5 | ERRLOG="$LOG"_ERR 6 | rm -f "$ERRLOG" 7 | 8 | #close the stream and redirect them to a custom or standard Syno Log 9 | exec 1<&- 10 | exec 2<&- 11 | exec 1>>$LOG 12 | exec 2>>$ERRLOG 13 | 14 | echo `date` "Granting access on log files for the webserver" 15 | chmod o+w $LOG 16 | chmod o+w $ERRLOG 17 | 18 | chown -R http "$SYNOPKG_PKGDEST/ui" 19 | 20 | # set the name of the package in the nginx config and router.cgi 21 | sed -i -e "s|@MODS_CGI@|$SYNOPKG_PKGNAME|g" "$SYNOPKG_PKGDEST/ui/dsm.cgi.conf" 22 | sed -i -e "s|@SYNOPKG_PKGNAME@|$SYNOPKG_PKGNAME|g" "$SYNOPKG_PKGDEST/ui/router.cgi" 23 | 24 | #link the nginx config to redirect pages accessed on admin port 25 | rm -f /usr/syno/share/nginx/conf.d/dsm.$SYNOPKG_PKGNAME.conf 26 | ln -s $SYNOPKG_PKGDEST/ui/dsm.cgi.conf /usr/syno/share/nginx/conf.d/dsm.$SYNOPKG_PKGNAME.conf 27 | 28 | #restating nginx is done via package's dependencies (instuninst_restart_services) 29 | #sudo synoservicecfg --reload nginx 30 | 31 | #authorize http user to execute synoservicecfg and the move/remove package scripts 32 | grep -q "http ALL=NOPASSWD: /usr/syno/sbin/synoservicecfg" /etc/sudoers 33 | if [[ $? != 0 ]]; then 34 | chmod u+w /etc/sudoers 35 | echo "" >> /etc/sudoers 36 | echo "#Added by $SYNOPKG_PKGNAME" >> /etc/sudoers 37 | echo "http ALL=NOPASSWD: /usr/syno/sbin/synoservicecfg, $SYNOPKG_PKGDEST/ui/rmpkg.sh, $SYNOPKG_PKGDEST/ui/mvpkg.sh" >> /etc/sudoers 38 | chmod u-w /etc/sudoers 39 | fi 40 | 41 | if [ -s "$ERRLOG" ]; then 42 | echo `date` "----------------------------------------------------" 43 | cat $ERRLOG 44 | echo `date` "----------------------------------------------------" 45 | # make the log pretty to be displayed by the Catalog Manager 46 | echo `date` "Prettifying the POST INSTALL log file" 47 | sed -i 's/$/
/' "$ERRLOG" 48 | cat $ERRLOG >> $SYNOPKG_TEMP_LOGFILE 49 | exit 1 50 | fi 51 | 52 | exit 0 -------------------------------------------------------------------------------- /scripts/postuninst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 -------------------------------------------------------------------------------- /scripts/postupgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 -------------------------------------------------------------------------------- /scripts/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 3 | -------------------------------------------------------------------------------- /scripts/preuninst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 3 | -------------------------------------------------------------------------------- /scripts/preupgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 3 | -------------------------------------------------------------------------------- /scripts/start-stop-status: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | case $1 in 3 | start) 4 | exit 0 5 | ;; 6 | stop) 7 | exit 0 8 | ;; 9 | status) 10 | exit 0 11 | ;; 12 | log) 13 | exit 0 14 | ;; 15 | esac 16 | 17 | exit 0 --------------------------------------------------------------------------------