2023-10-22 16:54:14 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
TITLE="nanodesk-installer-gxm"
|
|
|
|
VERSION=$(cat /usr/share/nanodesk/version)
|
|
|
|
|
|
|
|
GXMCMD="gxmessage -name $TITLE -center -geometry 669x420 -wrap -font mono,10 -file -"
|
2023-10-22 18:22:26 +02:00
|
|
|
|
|
|
|
GXMINFO="gxmessage -font mono,16 -name $TITLE -buttons Close -default Close -file -"
|
|
|
|
|
2023-10-22 16:54:14 +02:00
|
|
|
DOCROOT="/usr/share/doc/nanodesk-installer"
|
|
|
|
DILLOCMD="dillo -f -g 640x480 $DOCROOT"
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
TARGET=""
|
|
|
|
|
2023-10-22 16:54:14 +02:00
|
|
|
# initialize RETURN with a high value
|
|
|
|
RETURN=255
|
|
|
|
|
|
|
|
|
|
|
|
#####
|
|
|
|
#
|
|
|
|
# DIALOGES
|
|
|
|
#
|
|
|
|
#####
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
gxm-abort() {
|
2023-10-22 16:54:14 +02:00
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
echo "Installation aborted!"| $GXMINFO
|
2023-10-22 16:54:14 +02:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
gxm-welcome() {
|
2023-10-22 16:54:14 +02:00
|
|
|
echo " ----==== nanodesk-installer-gxm ====----
|
|
|
|
|
|
|
|
This is a gxmessage based Installation assistant for nanodesk.
|
|
|
|
|
|
|
|
To install nanodesk you need a partitioned and formated drive.
|
|
|
|
You can do the partioning and formating with 'GParted'.
|
|
|
|
|
|
|
|
If you need help how to do so, click on 'Help'.
|
|
|
|
|
|
|
|
When you are done partitioning and your installation target is formated,
|
|
|
|
go ahead with 'Install'." |
|
|
|
|
$GXMCMD -buttons "Abort:1,Help:2,GParted:10,Install:0"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
gxm-select-target() {
|
|
|
|
echo "Please enter the target and press 'Install'.
|
|
|
|
For example: /dev/sda1" |
|
|
|
|
$GXMCMD -entry -buttons "Abort:1,Help:2,Install:0"
|
|
|
|
return $?
|
|
|
|
}
|
2023-10-22 16:54:14 +02:00
|
|
|
#####
|
|
|
|
#
|
|
|
|
# HELP
|
|
|
|
#
|
|
|
|
#####
|
|
|
|
|
|
|
|
help-gparted() {
|
|
|
|
|
|
|
|
echo "help-gparted" | $GXMCMD
|
|
|
|
}
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
help-select-target() {
|
|
|
|
|
|
|
|
echo "help-gparted" | $GXMCMD
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-22 16:54:14 +02:00
|
|
|
#####
|
|
|
|
#
|
|
|
|
# EXEC
|
|
|
|
#
|
|
|
|
#####
|
|
|
|
|
|
|
|
exec-gparted() {
|
|
|
|
pkexec /usr/sbin/gparted
|
|
|
|
}
|
|
|
|
|
2023-10-22 18:22:26 +02:00
|
|
|
exec-nanodesk-installer() {
|
|
|
|
xterm -e /bin/bash -l -c "pkexec /usr/sbin/nanodesk-installer"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#####
|
|
|
|
#
|
|
|
|
# MAIN
|
|
|
|
#
|
|
|
|
#####
|
2023-10-22 16:54:14 +02:00
|
|
|
|
|
|
|
while [ $RETURN -gt 0 ]
|
|
|
|
do
|
2023-10-22 18:22:26 +02:00
|
|
|
gxm-welcome
|
2023-10-22 16:54:14 +02:00
|
|
|
RETURN=$?
|
|
|
|
echo CODE $RETURN
|
|
|
|
case $RETURN in
|
2023-10-22 18:22:26 +02:00
|
|
|
1) gxm-abort ;;
|
2023-10-22 16:54:14 +02:00
|
|
|
2) help-gparted ;;
|
|
|
|
10) exec-gparted ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
2023-10-22 18:22:26 +02:00
|
|
|
|
|
|
|
RETURN=255
|
|
|
|
while [ $RETURN -gt 0 ]
|
|
|
|
do
|
|
|
|
TARGET=$(gxm-select-target)
|
|
|
|
RETURN=$?
|
|
|
|
echo CODE $RETURN
|
|
|
|
echo TARGET $TARGET
|
|
|
|
|
|
|
|
|
|
|
|
# if RC = 1, then user clicked "abort"
|
|
|
|
case $RETURN in
|
|
|
|
1) gxm-abort ;;
|
|
|
|
2) help-select-target ;;
|
|
|
|
0) echo test if blockdevice
|
|
|
|
if [ ! -b "$TARGET" ]
|
|
|
|
then
|
|
|
|
RETURN=255
|
|
|
|
echo no
|
|
|
|
echo -e "Error!\n'${TARGET}' does not exist or is not a blockdevice!" | $GXMINFO
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# run the installer within xterm
|
|
|
|
|
|
|
|
xterm -e /bin/bash -c "pkexec /usr/sbin/nanodesk-installer $TARGET" &
|
|
|
|
#xterm -e /bin/bash -c "pkexec mc" &
|
|
|
|
#xterm -e /bin/bash -c "pkexec 'false ' ; echo $? ; echo 'Please press enter to continue...' ; read"
|
|
|
|
RETURN=$?
|
|
|
|
|
|
|
|
#if [ $RETURN != 0 ]
|
|
|
|
#then
|
|
|
|
# echo "ERROR!" | $GXMINFO
|
|
|
|
# exit 1
|
|
|
|
#else
|
|
|
|
# echo "SUCCESS!" | $GXMINFO
|
|
|
|
# exit 0
|
|
|
|
#fi
|
|
|
|
echo " ----==== nanodesk-installer-gxm ====----
|
|
|
|
|
|
|
|
The job of nanodesk-installer-gxm is done.
|
|
|
|
|
|
|
|
Please follow the instructions of the 'nanodesk-installer' which is running
|
|
|
|
in the other (xterm) window.
|
|
|
|
|
|
|
|
You can close this window now if you want. :) " | $GXMCMD -buttons Close -default Close
|
|
|
|
|
|
|
|
exit 0
|