Blame docker-builder-data/build/script/packet/opentoonz-nsis.sh

192cd8
DEPS="opentoonz-master"
192cd8
192cd8
pkfunc_register_file() {
192cd8
    local FILE=$1
192cd8
    local WIN_FILE=$(echo "$FILE" | sed "s|\/|\\\\|g")
192cd8
    ! [ -L "$FILE" ] || return 0
192cd8
192cd8
    if [ "${FILE:0:8}" = "./files-" ]; then
192cd8
        true # skip
192cd8
    elif [ "${FILE:0:24}" = "./share/opentoonz/stuff/" ]; then
192cd8
        if [ -d "$FILE" ]; then
192cd8
            echo "CreateDirectory \"\$STUFFDIR\\${WIN_FILE:24}\""   >> "files-stuff-install.nsh"
823a31
            foreachfile "$FILE" pkfunc_register_file
192cd8
            echo "RMDir \"\$STUFFDIR\\${WIN_FILE:24}\""             >> "files-stuff-uninstall.nsh"
192cd8
        else
192cd8
            echo "File \"/oname=${WIN_FILE:24}\" \"${WIN_FILE:2}\"" >> "files-stuff-install.nsh"
192cd8
            echo "Delete \"\$STUFFDIR\\${WIN_FILE:24}\""            >> "files-stuff-uninstall.nsh"
192cd8
        fi
192cd8
    elif [ "${FILE:0:2}" = "./" ]; then
192cd8
        if [ -d "$FILE" ]; then
192cd8
            echo "CreateDirectory \"\$INSTDIR\\${WIN_FILE:2}\""     >> "files-install.nsh"
823a31
            foreachfile "$FILE" pkfunc_register_file
192cd8
            echo "RMDir \"\$INSTDIR\\${WIN_FILE:2}\""               >> "files-uninstall.nsh" 
192cd8
        else
192cd8
            echo "File \"/oname=${WIN_FILE:2}\" \"${WIN_FILE:2}\""  >> "files-install.nsh"
192cd8
            echo "Delete \"\$INSTDIR\\${WIN_FILE:2}\""              >> "files-uninstall.nsh" 
192cd8
        fi
192cd8
    else
192cd8
        foreachfile $FILE pkfunc_register_file
192cd8
    fi
192cd8
}
192cd8
192cd8
pkinstall_release() {
192cd8
    # create temporary dir
192cd8
    rm -rf "$INSTALL_RELEASE_PACKET_DIR/installer"
192cd8
    mkdir -p "$INSTALL_RELEASE_PACKET_DIR/installer"
192cd8
    cd "$INSTALL_RELEASE_PACKET_DIR/installer" || return 1
192cd8
192cd8
    # copy files
192cd8
    copy "$ENVDEPS_RELEASE_PACKET_DIR" "./" || return 1
192cd8
    
192cd8
    # get version
823a31
    local LOCAL_VERSION=$(cat $ENVDEPS_RELEASE_PACKET_DIR/version-opentoonz-*)
192cd8
192cd8
    # create file lists
192cd8
    echo "create file lists"
192cd8
    pkfunc_register_file .
192cd8
    echo "created"
192cd8
192cd8
    # copy NSIS configuration
192cd8
    cp "$FILES_PACKET_DIR/opentoonz.nsi" "./" || return 1
192cd8
            
192cd8
    # create config.nsh (see opentoons.nsi)
192cd8
    cat > config.nsh << EOF
192cd8
!define PK_NAME         "OpenToonz" 
192cd8
!define PK_NAME_FULL    "OpenToonz"
192cd8
!define PK_ARCH         "$ARCH"
192cd8
!define PK_VERSION      "${LOCAL_VERSION:0:3}"
192cd8
!define PK_VERSION_FULL "${LOCAL_VERSION:0:11}" 
192cd8
!define PK_EXECUTABLE   "bin\\\${PK_NAME}_\${PK_VERSION}.exe" 
192cd8
EOF
192cd8
192cd8
    # let's go
192cd8
    makensis opentoonz.nsi || return 1
192cd8
192cd8
    # remove temporary dir
192cd8
    cd "$INSTALL_RELEASE_PACKET_DIR" || return 1
192cd8
    mv installer/*.exe ./ || return 1
192cd8
    rm -rf "installer"
192cd8
}