It is best if the password is typed by the person with sudo/root privileges.
So, not really addressing what the OP wants, this is my way.
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=updater-upgrader
Name[en_US]updater-upgrader
Exec=lxterminal -e sudo /home/username/scripts/updater-upgrader.sh
Comment[en_US]=
#!/bin/bash
#
# test if we are running with sudo
if [ id -u
-ne 0 ]
then
echo "not called with sudo"
exit
fi
#
# use red color for highlighting text
red="\x1b[31;01m"
# reset text colors to terminal default
reset="\x1b[39;49;00m"
#
echo -e "$red********************************************************$reset"
echo "Updater"
printf "Type$red YES$reset <enter> to continue updating : $red"
read yes
printf $reset
if [ "$yes" != "YES" ]
then exit
fi
echo -e "$red*****************************************************$reset"
echo "apt-get update"
apt-get update
echo -e "$red*****************************************************$reset"
#echo "apt-get upgrade --force-yes"
echo -e "$red*****************************************************$reset"
echo "apt-get install -f"
apt-get install -f
echo -e "$red*****************************************************$reset"
echo "apt-get -y autoremove"
apt-get -y autoremove
echo -e "$red********************************************************$reset"
echo
printf "Type$red YES$reset <enter> to reboot : $red"
read yes
printf $reset
if [ "$yes" == "YES" ]
then shutdown -r now
fi
exit 0
Double-click updater-upgrader in the Desktop (the .desktop part will not show), enter the password and start the process.
As always, no strings attached, use at your own risk, modify it completely or completely ignore this suggestion.