helixarch / debtap

A script for converting .deb packages into Arch Linux packages, focused on accuracy
GNU General Public License v2.0
1.37k stars 78 forks source link

Creates corrupt .INSTALL script #89

Open latekvo opened 1 year ago

latekvo commented 1 year ago

I will follow up on this later but Im running late today and just wanted to report as much as i remember for today. When i used debtap on Cisco packet tracer 8.2.1-1 debian package, the install script that had been generated was missing line 20 causing pacman to crash during the install with this error:

/tmp/alpm_qPMsyx/.INSTALL: line 20: syntax error near unexpected token `else'
/tmp/alpm_qPMsyx/.INSTALL: line 20: `       else'
/usr/bin/bash: line 1: pre_upgrade: command not found
error: command failed to execute correctly

context:

pre_install() {
    STATE=1 
    while [ "$STATE" != 0 -a "$STATE" != 4 ]; do
        case "$STATE" in
        1)
        ;;
        2)
        ;;
        3)
            if [ "$RET" = "false" ]; then
                exit 1
            fi
        ;;
        esac
            # here is the missing IF statement
            STATE=$(($STATE + 1))
        else
            STATE=$(($STATE - 1))
        fi
    done
    exit 0
}

I later determined the missing statement has to be

        if [ "$STATE" -eq 3 ]; then

Please ask me for any missing details.

latekvo commented 1 year ago

Hello I wanted to follow up, during the install, there was one more error in the .INSTALL script, but it didn't prevent packettracer from installing.

:: Processing package changes...
/tmp/alpm_6jAOKD/.INSTALL: line 128: syntax error near unexpected token `elif'
/tmp/alpm_6jAOKD/.INSTALL: line 128: `  elif [ ! -r $PROFILE ]; then'
(1/1) reinstalling packettracer                                                                                    [####################################################################] 100%
/tmp/alpm_BhgJf8/.INSTALL: line 128: syntax error near unexpected token `elif'
/tmp/alpm_BhgJf8/.INSTALL: line 128: `  elif [ ! -r $PROFILE ]; then'
gtk-update-icon-cache: No theme index file.

I confirm that after making the changes i made to the .INSTALL script, the program installs and runs as expected.

hyrodium commented 3 weeks ago

Hi, thank you for maintaining this repository!

I encountered a similar issue when I converted beam-studio_2.3.9_amd64.deb (https://flux3dp.com/downloads/). I tried the following command, but the installation with the converted file failed.

sudo debtap beam-studio_2.3.9_amd64.deb
sudo pacman -U beam-studio-2.3.9-1-x86_64.pkg.tar.zst 

Result:

loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) beam-studio-2.3.9-1

Total Installed Size:  998.22 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                                                                                                                                                                                                                 [##################################################################################################################################################################] 100%
(1/1) checking package integrity                                                                                                                                                                                                                               [##################################################################################################################################################################] 100%
(1/1) loading package files                                                                                                                                                                                                                                    [##################################################################################################################################################################] 100%
(1/1) checking for file conflicts                                                                                                                                                                                                                              [##################################################################################################################################################################] 100%
(1/1) checking available disk space                                                                                                                                                                                                                            [##################################################################################################################################################################] 100%
:: Processing package changes...
(1/1) installing beam-studio                                                                                                                                                                                                                                   [##################################################################################################################################################################] 100%
/tmp/alpm_mhAeyi/.INSTALL: line 6: syntax error near unexpected token `else'
/tmp/alpm_mhAeyi/.INSTALL: line 6: `    else'
/usr/bin/bash: line 1: post_install: command not found
error: command failed to execute correctly
Optional dependencies for beam-studio
    libappindicator-gtk3 [installed]
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...

Here is the generated .INSTALL file (which does not have the correct if statement in the second line):

post_install() {

        if [ -L '/usr/bin/beam-studio' -a -e '/usr/bin/beam-studio' -a "`readlink '/usr/bin/beam-studio'`" != '/etc/alternatives/beam-studio' ]; then
          rm -f '/usr/bin/beam-studio'
        fi
    else
        ln -sf '/opt/Beam Studio/beam-studio' '/usr/bin/beam-studio'
    fi

    # SUID chrome-sandbox for Electron 5+
    chmod 4755 '/opt/Beam Studio/chrome-sandbox' || true

    update-mime-database /usr/share/mime || true
    update-desktop-database /usr/share/applications || true
}

post_upgrade() {
    post_install
}

post_remove() {

    # Delete the link to the binary
    else
        rm -f '/usr/bin/beam-studio'
    fi
}