HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //var/packages/SynoOnlinePack_v2/scripts/postinst
#!/bin/sh
# Copyright (C) 2000-2023 Synology Inc. All rights reserved.

### This script will be executed when package installed and upgraded.
### Actions after package installed.
### ex. create database, create symbolic link...

main()
{
    local tmp_online_pack_dir=/tmp/SynoOnlinePack_v2
    rm -rf $tmp_online_pack_dir && mkdir -p /tmp
    local unique=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/synoinfo.conf unique)
    tar -C ${SYNOPKG_PKGDEST} -xvf ${SYNOPKG_PKGDEST}/all_model.tgz ./${unique}
    cp -r ${SYNOPKG_PKGDEST}/${unique} $tmp_online_pack_dir
    rm -rf ${SYNOPKG_PKGDEST}/*

    if [ ! -f /usr/syno/bin/syno_disk_online_db_update ]; then
        echo "Legacy OS version detected. The 'syno_disk_online_db_update' is not available; 'scemd' will perform the update instead."
        return 0
    fi

    # DSM#162012: Can utilize 'syno_disk_online_db_update --version' to check compatibility and adapt actions for different versions as needed.
    echo "Updating disk database..."
    /usr/syno/bin/syno_disk_online_db_update --update-native $tmp_online_pack_dir
    if [ "$?" != 0 ]; then
        echo "Failed to update db"
        rm -rf $tmp_online_pack_dir
        return 1
    fi
    rm -rf $tmp_online_pack_dir

    return 0
}

if ! main; then
    exit 1
fi

exit 0