Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default after-remove scriptlet failed on rpm target #8911

Open
Fachep opened this issue Feb 27, 2025 · 2 comments
Open

Default after-remove scriptlet failed on rpm target #8911

Fachep opened this issue Feb 27, 2025 · 2 comments

Comments

@Fachep
Copy link

Fachep commented Feb 27, 2025

> sudo dnf remove myapp
...
  准备中  :                                                                                                         1/1
  删除    : myapp-x.x.x-1.x86_64                                                                             1/1
  运行脚本: myapp-x.x.x-1.x86_64                                                                             1/1
未将 /usr/bin/myapp 配置为 myapp 的备用项
警告:%postun(myapp-x.x.x-1.x86_64) 脚本执行失败,退出状态码为 2

Error in POSTUN scriptlet in rpm package myapp
...

> update-alternatives --display myapp
myapp - 状态为自动。
 链接当前指向 /opt/MyApp/myapp
/opt/MyApp/myapp - 优先度 100
当前“最佳”版本是 /opt/MyApp/myapp。

> rpm -qp --scripts myapp-x.x.x-1.x86_64.rpm
postinstall scriptlet (using /bin/sh):
#!/bin/bash

if type update-alternatives 2>/dev/null >&1; then
    # Remove previous link if it doesn't use update-alternatives
    if [ -L '/usr/bin/myapp' -a -e '/usr/bin/myapp' -a "`readlink '/usr/bin/myapp'`" != '/etc/alternatives/myapp' ]; then
        rm -f '/usr/bin/myapp'
    fi
    update-alternatives --install '/usr/bin/myapp' 'myapp' '/opt/MyApp/myapp' 100 || ln -sf '/opt/MyApp/myapp' '/usr/bin/myapp'
else
    ln -sf '/opt/MyApp/myapp' '/usr/bin/myapp'
fi

# Check if user namespaces are supported by the kernel and working with a quick test:
if ! { [[ -L /proc/self/ns/user ]] && unshare --user true; }; then
    # Use SUID chrome-sandbox only on systems without user namespaces:
    chmod 4755 '/opt/MyApp/chrome-sandbox' || true
else
    chmod 0755 '/opt/MyApp/chrome-sandbox' || true
fi

if hash update-mime-database 2>/dev/null; then
    update-mime-database /usr/share/mime || true
fi

if hash update-desktop-database 2>/dev/null; then
    update-desktop-database /usr/share/applications || true
fi
postuninstall scriptlet (using /bin/sh):
#!/bin/bash

# Delete the link to the binary
if type update-alternatives >/dev/null 2>&1; then
    update-alternatives --remove 'myapp' '/usr/bin/myapp'
else
    rm -f '/usr/bin/myapp'
fi

> update-alternatives --version
alternatives(备用)版本 1.24

pnpm-lock.yaml:

electron-builder:
  specifier: ^25.1.8
  version: 25.1.8([email protected]([email protected]))

OS: Rocky Linux 9.5 (Blue Onyx) x86_64
Kernel: 6.13.4-1.el9.elrepo.x86_64

@mmaietta
Copy link
Collaborator

Can you please try the latest release 26.0.9 and report back your results?

@Fachep
Copy link
Author

Fachep commented Mar 1, 2025

I got same output for rpm -qp --scripts on [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants