chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

pkgimport-gui (897B)


      1 #!/bin/sh
      2 # what opens when you double-click a .deb or .rpm
      3 f=$1
      4 [ -f "$f" ] || exit 1
      5 name=$(basename "$f")
      6 zenity --question --title="Install package" --icon=system-software-install --ok-label=Install \
      7     --text="Install <b>$name</b>?\n\nOnly install packages from sites you trust." || exit 0
      8 log=$(mktemp)
      9 pkexec /usr/bin/pkgimport install "$f" > "$log" 2>&1 &
     10 pid=$!
     11 while kill -0 $pid 2>/dev/null; do echo "#Installing $name..."; sleep 1; done | \
     12     zenity --progress --pulsate --auto-close --no-cancel --title="Install package" --text="Installing $name..."
     13 wait $pid
     14 if [ $? = 0 ]; then
     15     pkg=$(sed -n 's/.* -> \([^ ]*\) (.*/\1/p' "$log" | head -n1)
     16     zenity --info --title="Install package" --text="<b>$name</b> is installed.\nRemove it with: sudo apk del $pkg"
     17 else
     18     zenity --text-info --title="Couldn't install $name" --width=640 --height=420 --filename="$log"
     19 fi
     20 rm -f "$log"