Permalink
Browse files

Update the shell version of the system flag utility to match the Qt v…

…ersion (only recognizes specific types of messages)
  • Loading branch information...
Ken Moore
Ken Moore committed Mar 26, 2014
1 parent 696b4b5 commit 2f2fd15c97e8255046cf83ed79eedc42232ec66c
Showing with 38 additions and 11 deletions.
  1. +13 −1 src-sh/pc-systemflag/man1/pc-systemflag.1
  2. +25 −10 src-sh/pc-systemflag/pc-systemflag
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010
+.\" Copyright (c) 2014
.\" iXsystems, Inc. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,18 @@ System update availability has changed
.It Ar NETRESTART
Network access changed
.El
+.Pp
+The following messages are available:
+.Bl -tag -width indent
+.It Ar WORKING
+Applications is currently working
+.It Ar ERROR
+Application finished with an error
+.It Ar SUCCESS
+Application finished successfully
+.It Ar UPDATE
+Updates are available for the application
+.El
.Sh HISTORY
This version of
.Nm
@@ -2,16 +2,23 @@
#Set cross-application notification flags
manpage(){
-echo "USAGE: pc-systemflag <FLAG> <Optional Message>
+echo "USAGE: pc-systemflag <FLAG> <MESSAGE>
FLAGS:
PBIUPDATE - PBI Update Availability Changed
PKGUPDATE - pkg Update Availability Changed
SYSUPDATE - System Update Availability Changed
NETRESTART - Network Access Changed
-EXAMPLE 1: pc-systemflag PBIUPDATE \"Updates Available\"
-EXAMPLE 2: pc-systemflag NETRESTART"
-
+ MESSAGES:
+ WORKING - App is currently working
+ ERROR - App experienced an error
+ SUCCESS - App finished successfully
+ UPDATE - App has updates available
+
+EXAMPLE 1: pc-systemflag PBIUPDATE UPDATE (A PBI can be updated)
+EXAMPLE 2: pc-systemflag NETRESTART SUCCESS (Network restarted successfully)
+EXAMPLE 3: pc-systemflag SYSUPDATE ERROR (Could not check for system updates)
+"
exit 1
}
@@ -22,7 +29,7 @@ elif [ ! -n "${1}" ]; then
manpage
fi
-echo "${1} + ${2}"
+#echo "${1} + ${2}"
#Always check for the existance of the flag directory and try to create it if possible
FLAGDIR="/tmp/.pcbsdflags"
@@ -46,11 +53,19 @@ else
manpage
fi
-#Set the flag
-if [ -n "${2}" ]; then
- echo "${2}" > ${FLAGFILE}
+#Figure out which flag message this is
+if [ ${2} = "WORKING" ]; then
+ MSG="working"
+elif [ ${2} = "ERROR" ]; then
+ MSG="error"
+elif [ ${2} = "SUCCESS" ]; then
+ MSG="success"
+elif [ ${2} = "UPDATE" ]; then
+ MSG="updateavailable"
else
- touch ${FLAGFILE}
+ echo "Invalid Message: ${2}"
+ manpage
fi
-#chmod 777 ${FLAGFILE}
+#Set the flag
+echo ${MSG} > ${FLAGFILE}
exit 0

0 comments on commit 2f2fd15

Please sign in to comment.