HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/lib/dpkg/info/bamfdaemon.postinst
#! /bin/sh
set -e

BAMF_INDEX_NAME="bamf-2.index"

if [ "$1" = "configure" ] || [ "$1" = "triggered" ]; then
    if [ -d /usr/share/applications ]; then
        # rebuild index
        I=/usr/share/applications/$BAMF_INDEX_NAME
        echo "Rebuilding $I..."
        rm -f $I
        perl -e '
use File::Find;
my $dir_name;

sub strip_exec
{
    my $f = $_;
    return unless $f =~ /\.desktop$/;
    return unless ("$File::Find::dir" eq "$dir_name");
    my @lines;
    open F, $f;
    @lines = <F>;
    close F;
    my $in_desktop_entry = 0;
    my $exec = "";
    my $class = "";
    my $no_display = "false";
    my $only_show_in = "";

    foreach (@lines)
    {
        if (/^\[\s*(.+)\s*\]/)
        {
            $was_in_desktop = $in_desktop_entry;
            $in_desktop_entry = ($1 eq "Desktop Entry");

            if ($was_in_desktop and !$in_desktop_entry)
            {
                last;
            }
        }

        if ($in_desktop_entry)
        {
            if (/^Exec=(.+)$/)
            {
                $exec = $1;
                $exec =~ s/^\s+|\s+$//g;
            }

            if (/^NoDisplay=(.+)$/)
            {
                $no_display = $1;
                $no_display =~ s/^\s+|\s+$//g;
            }

            if (/^OnlyShowIn=(.+)$/)
            {
                $only_show_in = $1;
                $only_show_in =~ s/^\s+|\s+$//g;
            }

            if (/^StartupWMClass=(.+)$/)
            {
                $class = $1;
                $class =~ s/^\s+|\s+$//g;
            }
        }
    }

    if ($exec ne "")
    {
        print "$f\t$exec\t$class\t$only_show_in\t$no_display\n";
    }
};

$dir_name = $ARGV[-1];
$dir_name = $1 if($dir_name=~/(.*)\/$/);
find(\&strip_exec, $dir_name);' /usr/share/applications > $I.new || rm -f $I.new

        [ -e $I.new ] && mv $I.new $I || true
    fi
fi