Test scripts.

This commit is contained in:
Nuno Cruces 2022-03-24 16:37:21 +00:00
parent ce1fd9516a
commit a486270115
10 changed files with 77 additions and 0 deletions

12
scripts/color.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
COLOR=`zenity --color-selection --show-palette`
case $? in
0)
echo "You selected $COLOR.";;
1)
echo "No color selected.";;
-1)
echo "An unexpected error has occurred.";;
esac

9
scripts/entry.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
if zenity --entry \
--title="Add new profile" \
--text="Enter name of new profile:" \
--entry-text "NewProfile"
then echo "OK"
else echo "No name entered"
fi

3
scripts/error.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec zenity --error --text="Could not find /var/log/syslog."

12
scripts/file.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
FILE=`zenity --file-selection --title="Select a File"`
case $? in
0)
echo "\"$FILE\" selected.";;
1)
echo "No file selected.";;
-1)
echo "An unexpected error has occurred.";;
esac

3
scripts/info.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec zenity --info --text="Merge complete. Updated 3 of 10 files."

5
scripts/notification-listen.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
cat <<EOH| zenity --notification --listen
message: this is the message text
EOH

5
scripts/notification.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
exec zenity --notification \
--window-icon="info" \
--text="There are system updates necessary!"

22
scripts/progress.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
(
echo "10" ; sleep 1
echo "# Updating mail logs" ; sleep 1
echo "20" ; sleep 1
echo "# Resetting cron jobs" ; sleep 1
echo "50" ; sleep 1
echo "This line will just be ignored" ; sleep 1
echo "75" ; sleep 1
echo "# Rebooting system" ; sleep 1
echo "100" ; sleep 1
) |
zenity --progress \
--title="Update System Logs" \
--text="Scanning mail logs..." \
--percentage=0
if [ "$?" = -1 ]; then
zenity --error \
--text="Update canceled."
fi

3
scripts/question.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec zenity --question --text="Are you sure you wish to proceed?"

3
scripts/warning.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec zenity --warning --text="Disconnect the power cable to avoid electrical shock."