Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a new src-sh utility: pc-systemflag

This is the shell-script counterpart to the Qt system flag system. It allows for the setting of a particular flag for the graphical utilities to be able to pick up when they need to refresh/update appropriately.
  • Loading branch information...
commit 280ce711680098b9e53ace6457c39da8fb34ac1f 1 parent 3584759
@beanpole135 beanpole135 authored
View
13 src-sh/pc-systemflag/Makefile
@@ -0,0 +1,13 @@
+#############################################################################
+# Makefile for building: pc-systemflag
+#############################################################################
+PREFIX?= /usr/local
+
+####### Install
+
+all:
+
+install_doinstall:
+ sh install.sh $(PREFIX)
+
+install: install_doinstall
View
25 src-sh/pc-systemflag/install.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ -z "$1" ] ; then
+ LOCALBASE=/usr/local
+else
+ LOCALBASE="$1"
+fi
+
+# Install manpages
+mkdir -p ${LOCALBASE}/man/man8 >/dev/null 2>/dev/null
+for i in `ls man8/`
+do
+ if [ -e "${LOCALBASE}/man/man8/${i}.gz" ] ; then
+ rm ${LOCALBASE}/man/man8/${i}.gz >/dev/null 2>/dev/null
+ fi
+ gzip -c man8/${i} > ${LOCALBASE}/man/man8/${i}.gz
+done
+
+# Install the executable
+if [ ! -d "${LOCALBASE}/bin" ] ; then
+ mkdir ${LOCALBASE}/bin
+fi
+cp pc-systemflag ${LOCALBASE}/bin/pc-systemflag
+chown root:wheel ${LOCALBASE}/bin/pc-systemflag
+chmod 755 ${LOCALBASE}/bin/pc-systemflag
View
65 src-sh/pc-systemflag/man8/pc-systemflag.8
@@ -0,0 +1,65 @@
+.\" Copyright (c) 2010
+.\" iXsystems, Inc. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Jordan Hubbard OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD:
+
+.\"
+.Dd June 24, 2010
+.Dt PC-SYSTEMFLAG 8
+.Os
+.Sh NAME
+.Nm pc-systemflag
+.Nd PC-BSD System inter-application notification system
+.Sh SYNOPSIS
+.Nm
+.Op Ar flag
+.Op Ar optional message
+.Sh DESCRIPTION
+The
+.Nm
+utility is the shell entrance point to the PC-BSD cross-application
+notification system. It basically provides the ability for CLI
+applications and graphical applications to communicate basic information
+such when particular types of updates are available or completed. This
+ensures that any running applications (usually graphical) are able to
+update/refresh on demand and avoid duplicate background tasks.
+.Pp
+The following flags are available:
+.Bl -tag -width indent
+.It Ar PBIUPDATE
+PBI update availability has changed
+.It Ar PKGUPDATE
+Package update availability has changed
+.It Ar SYSUPDATE
+System update availability has changed
+.It Ar NETRESTART
+Network access changed
+.El
+.Sh HISTORY
+This version of
+.Nm
+first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An Ken Moore Aq ken@pcbsd.org
View
56 src-sh/pc-systemflag/pc-systemflag
@@ -0,0 +1,56 @@
+#!/bin/sh
+#Set cross-application notification flags
+
+manpage(){
+echo "USAGE: pc-systemflag <FLAG> <Optional 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"
+
+exit 1
+}
+
+#Check for help pages
+if [ ${1} = "-h" -o ${1} = "help" ]; then
+ manpage
+elif [ ! -n "${1}" ]; then
+ manpage
+fi
+
+echo "${1} + ${2}"
+
+#Always check for the existance of the flag directory and try to create it if possible
+FLAGDIR="/tmp/.pcbsdflags"
+if [ ! -d ${FLAGDIR} ]; then
+ mkdir -p -m 777 ${FLAGDIR}
+fi
+
+#Figure out which flag type this is for
+if [ ${1} = "PBIUPDATE" ]; then
+ FLAGFILE="${FLAGDIR}/pbi-update-available-${LOGNAME}"
+elif [ ${1} = "PKGUPDATE" ]; then
+ FLAGFILE="${FLAGDIR}/pkg-update-available-${LOGNAME}"
+elif [ ${1} = "SYSUPDATE" ]; then
+ FLAGFILE="${FLAGDIR}/sys-update-available-${LOGNAME}"
+elif [ ${1} = "NETRESTART" ]; then
+ FLAGFILE="${FLAGDIR}/network-restarted-${LOGNAME}"
+elif [ ${1} = "CHECKDIR" ]; then
+ exit 0
+else
+ echo "Invalid Option: ${1}"
+ manpage
+fi
+
+#Set the flag
+if [ -n "${2}" ]; then
+ echo "${2}" > ${FLAGFILE}
+else
+ touch ${FLAGFILE}
+fi
+#chmod 777 ${FLAGFILE}
+exit 0
Please sign in to comment.
Something went wrong with that request. Please try again.