|
From: <abe...@us...> - 2013-07-12 18:10:50
|
Revision: 6130
http://sourceforge.net/p/astlinux/code/6130
Author: abelbeck
Date: 2013-07-12 18:10:44 +0000 (Fri, 12 Jul 2013)
Log Message:
-----------
New package 'asterisk-fop2', adds the framework for supporting the 'Flash Operator Panel 2' (free for 15 buttons, very reasonable for unlimited). The actual 'fop2' code is downloaded on ASTURW as a 'package' using the new CLI command 'upgrade-package'
Modified Paths:
--------------
branches/1.0/astlinux-ast11.config
branches/1.0/astlinux.config
branches/1.0/astlinux18.config
branches/1.0/package/Config.in
branches/1.0/package/lighttpd/lighttpd.conf
branches/1.0/package/lighttpd/lighttpd.init
branches/1.0/project/astlinux/target_skeleton/usr/sbin/show-union
branches/1.0/toolchain/file_exclude
Added Paths:
-----------
branches/1.0/package/asterisk-fop2/
branches/1.0/package/asterisk-fop2/Config.in
branches/1.0/package/asterisk-fop2/asterisk-fop2.mk
branches/1.0/package/asterisk-fop2/config/
branches/1.0/package/asterisk-fop2/config/buttons.cfg
branches/1.0/package/asterisk-fop2/config/fop2.cfg
branches/1.0/package/asterisk-fop2/fop2.init
branches/1.0/project/astlinux/target_skeleton/stat/var/packages/
branches/1.0/project/astlinux/target_skeleton/usr/sbin/upgrade-package
Modified: branches/1.0/astlinux-ast11.config
===================================================================
--- branches/1.0/astlinux-ast11.config 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/astlinux-ast11.config 2013-07-12 18:10:44 UTC (rev 6130)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6103-dirty Configuration
-# Sun May 26 15:57:43 2013
+# Buildroot 2011.08-svn6129-dirty Configuration
+# Fri Jul 12 11:14:34 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -170,6 +170,7 @@
#
# BR2_PACKAGE_ASTERISK_MENUSELECT is not set
BR2_PACKAGE_ASTERISK_CODEC_SILK=y
+BR2_PACKAGE_ASTERISK_FOP2=y
BR2_PACKAGE_ASTERISK_GUI=y
BR2_PACKAGE_DAHDI_LINUX=y
BR2_PACKAGE_DAHDI_OSLEC=y
Modified: branches/1.0/astlinux.config
===================================================================
--- branches/1.0/astlinux.config 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/astlinux.config 2013-07-12 18:10:44 UTC (rev 6130)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6103-dirty Configuration
-# Sun May 26 15:57:35 2013
+# Buildroot 2011.08-svn6129-dirty Configuration
+# Fri Jul 12 11:14:23 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -176,6 +176,7 @@
BR2_PACKAGE_ASTERISK_APP_WAITUNTIL=y
BR2_PACKAGE_ASTERISK_FUNC_DEVSTATE=y
BR2_PACKAGE_ASTERISK_FUNC_EXTSTATE=y
+BR2_PACKAGE_ASTERISK_FOP2=y
BR2_PACKAGE_ASTERISK_GUI=y
BR2_PACKAGE_DAHDI_LINUX=y
BR2_PACKAGE_DAHDI_OSLEC=y
Modified: branches/1.0/astlinux18.config
===================================================================
--- branches/1.0/astlinux18.config 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/astlinux18.config 2013-07-12 18:10:44 UTC (rev 6130)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6103-dirty Configuration
-# Sun May 26 15:57:40 2013
+# Buildroot 2011.08-svn6129-dirty Configuration
+# Fri Jul 12 11:14:30 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -170,6 +170,7 @@
#
# BR2_PACKAGE_ASTERISK_MENUSELECT is not set
BR2_PACKAGE_ASTERISK_APP_NOTIFY=y
+BR2_PACKAGE_ASTERISK_FOP2=y
BR2_PACKAGE_ASTERISK_GUI=y
BR2_PACKAGE_DAHDI_LINUX=y
BR2_PACKAGE_DAHDI_OSLEC=y
Modified: branches/1.0/package/Config.in
===================================================================
--- branches/1.0/package/Config.in 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/package/Config.in 2013-07-12 18:10:44 UTC (rev 6130)
@@ -12,6 +12,7 @@
source "package/asterisk-codec-silk/Config.in"
source "package/asterisk-func_devstate/Config.in"
source "package/asterisk-func_extstate/Config.in"
+source "package/asterisk-fop2/Config.in"
source "package/asterisk-gui/Config.in"
source "package/dahdi-linux/Config.in"
source "package/dahdi-tools/Config.in"
Added: branches/1.0/package/asterisk-fop2/Config.in
===================================================================
--- branches/1.0/package/asterisk-fop2/Config.in (rev 0)
+++ branches/1.0/package/asterisk-fop2/Config.in 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_ASTERISK_FOP2
+ bool "asterisk-fop2"
+ depends on BR2_PACKAGE_ASTERISK
+ default n
+ help
+ Asterisk Operator Panel 2
+ Free version for up to 15 buttons.
+
+ Note: Only the supporting framework is included on the AstLinux image,
+ use the CLI command...
+ "upgrade-package fop2 upgrade"
+ to install 'fop2' at runtime.
+
+ http://www.fop2.com/
+
Added: branches/1.0/package/asterisk-fop2/asterisk-fop2.mk
===================================================================
--- branches/1.0/package/asterisk-fop2/asterisk-fop2.mk (rev 0)
+++ branches/1.0/package/asterisk-fop2/asterisk-fop2.mk 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,28 @@
+#############################################################
+#
+# asterisk-fop2
+#
+#############################################################
+ASTERISK_FOP2_VERSION = 2.27
+ASTERISK_FOP2_SOURCE = fop2-$(ASTERISK_FOP2_VERSION)-debian-i386.tgz
+ASTERISK_FOP2_SITE = http://download.fop2.com
+# Note: be sure to edit "project/astlinux/target_skeleton/usr/sbin/upgrade-package" on version change
+
+define ASTERISK_FOP2_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0755 package/asterisk-fop2/fop2.init $(TARGET_DIR)/etc/init.d/fop2
+ $(INSTALL) -D -m 0644 package/asterisk-fop2/config/fop2.cfg $(TARGET_DIR)/stat/etc/fop2/fop2.cfg
+ $(INSTALL) -D -m 0644 package/asterisk-fop2/config/buttons.cfg $(TARGET_DIR)/stat/etc/fop2/buttons.cfg
+ ln -snf /tmp/etc/fop2 $(TARGET_DIR)/etc/fop2
+ ln -sf ../../init.d/fop2 $(TARGET_DIR)/etc/runlevels/default/S82fop2
+ ln -sf ../../init.d/fop2 $(TARGET_DIR)/etc/runlevels/default/K00fop2
+endef
+
+define ASTERISK_FOP2_UNINSTALL_TARGET_CMDS
+ rm -f $(TARGET_DIR)/etc/init.d/fop2
+ rm -rf $(TARGET_DIR)/stat/etc/fop2
+ rm -f $(TARGET_DIR)/etc/fop2
+ rm -f $(TARGET_DIR)/etc/runlevels/default/S82fop2
+ rm -f $(TARGET_DIR)/etc/runlevels/default/K00fop2
+endef
+
+$(eval $(call GENTARGETS,package,asterisk-fop2))
Added: branches/1.0/package/asterisk-fop2/config/buttons.cfg
===================================================================
--- branches/1.0/package/asterisk-fop2/config/buttons.cfg (rev 0)
+++ branches/1.0/package/asterisk-fop2/config/buttons.cfg 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,46 @@
+;
+; Example FOP2 Buttons
+;
+;[SIP/620]
+;type=extension
+;extension=620
+;context=from-internal
+;label=Nicolas
+;mailbox=620@default
+;extenvoicemail=*620@from-internal
+;external=5551234@from-internal
+;privacy=clid
+;queuechannel=Local/620@from-queue/n|Penalty=1|MemberName=Nicolas|StateInterface=SIP/620
+;
+;[SIP/621]
+;type=extension
+;extension=621
+;context=from-internal
+;label=Mary
+;mailbox=621@default
+;extenvoicemail=*621@from-internal
+;external=5554444@from-internal
+;privacy=monitor
+;cssclass=someExtraCSSClass
+;
+;[QUEUE/100]
+;type=queue
+;label=Sales
+;extension=100
+;context=from-internal
+;tags=sales,london
+;
+;[DAHDI/1]
+;type=trunk
+;label=DAHDI
+;channel=DAHDI/2
+;channel=DAHDI/3
+;channel=DAHDI/4
+;
+;[CONFERENCE/1000]
+;type=conference
+;label=Test Conference
+;server=1
+;extension=1000
+;context=from-internal
+
Added: branches/1.0/package/asterisk-fop2/config/fop2.cfg
===================================================================
--- branches/1.0/package/asterisk-fop2/config/fop2.cfg (rev 0)
+++ branches/1.0/package/asterisk-fop2/config/fop2.cfg 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,241 @@
+[general]
+; AMI definitions
+manager_host=localhost
+manager_port=5038
+manager_user=admin
+manager_secret=amp111
+;event_mask=agent,call,command,system,user,dialplan
+
+; Daemon definitios
+;listen_port = 4445
+;restrict_host = www.asternic.org
+web_dir = /stat/var/packages/fop2/html
+
+; Global Config
+poll_interval = 86400
+poll_voicemail = 1
+monitor_ipaddress = 0
+
+; Force blind transfer on asterisk 1.6
+blind_transfer = 1
+
+; Force supervised transfer on asterisk 1.4
+; requires the atxfer manager backport patch
+; supervised_transfer = 1
+
+; Force delimiter for asterisk applications
+; force_parameter_delimiter = ","
+
+; When adding or removing members to a queue, fop2 will default to
+; AddQueueMember/RemoveQueueMember commands. If you set use_agentlogin
+; to 1, together with the QueueChannel in a button definition set to
+; an Agent number it will use AgentCallbackLogin and Agentlogoff instead.
+;
+; use_agentlogin = 0
+
+
+; Master Password that overrides any individual one
+;master_key = 5678
+
+
+
+; Options to send to chan_spy when doing a Listen action
+; This global setting is overriden by the individual button
+; spyoptions directive if set (in the button config).
+; Asterisk 1.6.1 or higher has the option "d" that lets you
+; switch spying modes using the keypad:
+;4 = spy mode
+;5 = whisper mode
+;6 = barge mode
+spy_options="bq"
+
+; Options to send to chan_spy when doing a Whisper action
+; In Asterisk 1.6.1 or higher you can use B to enable barge (speak
+; to both channels on a call).
+whisper_options = "w"
+
+; When you spy to an ongoing call, your spy session will end as
+; soon as the conversation you are listening to finishes. If you
+; rather keep the chan spy session open after the call end, uncomment
+; the following line.
+;persistent_spy=1
+
+; Filename to use when start monitoring, you can use ${UNIQUEID},
+; ${ORIG_EXTENSION}, ${DEST_EXTENSION}
+; and date formats %Y %m %d to construct the filename.
+;
+; Settings for modifying the recording filename
+; Available variables are:
+; ${UNIQUEID} = Unique Id of the call
+; ${TIMESTAMP} = Unix Timestamp when the recording was initiated
+; ${CLIDNUM} = Callerid or Dialed number for the active call
+; ${CLIDNAME} = Callerid name for the active call
+; ${DEST_EXTENSION} = Target extenstion being monitored
+; ${ORIG_EXTENSION} = Extension/User that started the recording (not
+; the other leg)
+; ${MBOX} = Mailbox of the extension/user that started the
+; recording
+; ${FOP2CONTEXT} = FOP2 Panel Context
+;
+; Date variables:
+; %Y 4 digits year
+; %y 2 digits year
+; %m 2 digits month
+; %d 2 digits day
+; %h 2 digits hour
+; %i 2 digits minute
+; %s 2 digits seconds
+
+; For elastix Monitoring Tab:
+; monitor_filename=g${DEST_EXTENSION}-${UNIQUEID}
+
+; For fop2 recording interface
+monitor_filename=/var/spool/asterisk/monitor/${ORIG_EXTENSION}_${DEST_EXTENSION}_%h%i%s_${UNIQUEID}
+monitor_format=wav
+monitor_mix=true
+
+; To enable the recording interface you must uncomment the following
+; line, but also you might need to modify the script a little bit
+; depending on the sox version you have installed.
+;
+;monitor_exec=/usr/local/fop2/recording_fop2.pl
+
+; You could specify your own script to be executed when the recording
+; is finished. It will receive 3 parameters, the complete
+; path and filename of the IN leg, the OUT leg and the final
+; recording NAME. You should run soxmix in your script to join
+; the recordings into one file.
+;
+; monitor_exec=/var/lib/asterisk/bin/postrecording-script.sh
+
+; FOP2 can fire notifications/popups when an extension or queue
+; member receives a call. The default behaviour is to show a
+; notification on state RINGING (notify_on_ringing=1).
+;
+; To customize notifications, you must uncomment the custom_popup
+; function in checkdir.php you can replace that notification with
+; a custom popup function to integrate with other web applications.
+;
+; For call centers you might need to perform a popup not on the
+; RINGING state but when the call is CONNECTED to an agent. If you
+; set in the queue configuration in queues.conf the option
+; eventwhencalled=yes and then set here notify_on_connect=1,
+; fop2 will send notifications on queue connected calls
+; during AGENTCONNECT events. This will only work for inbound calls
+; from a queue.
+;
+; notify_on_ringing = 1
+; notify_on_connect = 1
+
+; Call pickup uses the pickupmark variable by default. In multi tenant
+; systems this might lead to problems as you might end un picking up
+; some other tenant call. In that case you might want to try to
+; pickup the call by its context uncomenting the following line:
+;
+; no_pickupmark=1
+
+; If your asterisk version supports the pickupchan application it is
+; much better to use this than the regular pickup application as it will
+; be directed towards the channel and not the extension, makeing it
+; more precise.
+;
+; use_pickupchan=1
+
+; Path to your voicemail directory
+; For voicemail to work the fop2 server must run on the same server
+; as asterisk, or your voicemail directory must be network mounted
+voicemail_path=/var/spool/asterisk/voicemail
+
+; For odbc based voicemail storage, you can set voicemail path to
+; dbi:ODBC:name , where name is the dsn name as setup in odbc.ini
+; By default the voicemessages table will be used, if you use a
+; different one, you can specify it by appending !tablename
+;
+;voicemail_path=dbi:ODBC:asterisk!voicemessages
+
+; By default IM chats are not logged/saved. If you uncomment
+; the following parameter, all chats will be stored on the chatlog
+; table inside the fop2settings.db sqlite database.
+;
+; save_chat_log=1
+
+
+; Khomp GSM interface to send SMS messages
+; If there is a card plugged, fop2 will auto discover it
+; and use the first one available. If you want to change it
+; to a fixed one, uncomemnt the folowing line and change the name
+; to your liking
+;
+; khomp_gsm=Khomp/b0
+
+; Chan Dongle interface to send SMS messages
+;
+; dongle_gsm=dongle01
+
+; SMS Web based API
+;
+; It is possible to define a web based sms provider to send SMS via FOP2
+; The parameters to set are sms_api_url, smps_api_method, sms_api_user,
+; sms_api_password and sms_api_reponse_error
+;
+; The sms_api_url parameter must include the parameters to send to the API
+; provider to send the message, you can use the following variables on them
+; ${MESSAGE} The sms message to send
+; ${NUMBER} The destination number to send the SMS
+;
+; The sms_api_response_error is the string returned by the web call if
+; there was an error with the sending. The default value is 'error', but
+; some providers might respond with some other strings. Anything returned
+; that does not contain the error string will be considered as a successful
+; delivery
+;
+; Sample to send SMS via yx wireless gateways, replace GATEWAY_ADDRESS,
+; USER and PASSWORD with the correct values for your system:
+;
+; sms_api_url=http://GATEWAY_ADDRESS/cgi-bin/exec?cmd=api_queue_sms&username=USER&password=PASSWORD&content=${MESSAGE}&destination=${NUMBER}&api_version=0.05&channel=1
+; sms_api_method=GET
+; sms_api_user=USER
+; sms_api_password=PASSWORD
+
+; Sample to send SMS via smsified.com service, replace SERVICENUMBER,
+; USER and PASSWORD with the correct values for your system:
+;
+; sms_api_url=http://api.smsified.com/v1/smsmessaging/outbound/SERVICENUMBER/requests?address=${NUMBER}&message=${MESSAGE}
+; sms_api_method=POST
+; sms_api_user=USER
+; sms_api_password=PASSWORD
+; sms_api_response_error=error
+
+
+; --- SAMPLE CUSTOM PERMISSIONS ---
+; format: perm= CUSTOM_NAME : PERMISSIONS : DEVICES
+; perm=salessupervisor:hangup,spy,queuemanager:SIP/604,SIP/607,SIP/605,SIP/606
+;
+; A custom permission can later be assigned to a user, you cannot use
+; a reserved permission name for it or you will have issues.
+; --- END SAMPLE ---
+
+
+; --- SAMPLE GROUPS ---
+; group=queues:QUEUE/100,QUEUE/101
+; group=deptA:SIP/100,SIP/101,SIP/102
+; --- END SAMPLE ---
+
+; --- SAMPLE USER LIST ---
+; format: user= EXTENSION : SECRET : PERMISSIONS : GROUPS
+; You can enumerate several permissions and groups separated by comma
+; available permissions: 'all', 'dial', 'hangup', 'meetme', 'pickup',
+; 'record', 'spy', 'transfer', 'whisper',
+; 'queuemanager', 'queueagent', 'phonebook',
+; 'chat', 'preferences', 'hangupself',
+; 'recordself', 'voicemailadmin'
+;
+; user=620:1234:all:queues
+; user=621:1234:dial,transfer,pickup:deptA
+; user=622:1234:all
+; user=623:1234:meetme,pickup
+; buttonfile=buttons.cfg
+; ------ END SAMPLE ------
+
+buttonfile=buttons.cfg
+
Added: branches/1.0/package/asterisk-fop2/fop2.init
===================================================================
--- branches/1.0/package/asterisk-fop2/fop2.init (rev 0)
+++ branches/1.0/package/asterisk-fop2/fop2.init 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+## Package: fop2
+## Description: Flash Operator Panel 2
+## Requirements: Asterisk AMI
+
+# No variables required
+#. /etc/rc.conf
+
+PACKAGES_DIR="/stat/var/packages"
+
+FOP2_SERVER="$PACKAGES_DIR/fop2/server/fop2_server"
+
+PIDFILE="/var/run/fop2.pid"
+
+TMPSIZEMAX=30000
+
+init () {
+
+ if [ ! -x $FOP2_SERVER ]; then
+ return
+ fi
+
+ if [ ! -d /mnt/kd/fop2 ]; then
+ cp -a /stat/etc/fop2 /mnt/kd/
+ fi
+ ln -snf /mnt/kd/fop2 /tmp/etc/fop2
+
+ if [ $(df -k /tmp | awk '/ \/tmp$/ { print $2; nextfile }') -lt ${TMPSIZEMAX} ]; then
+ mount -o remount,size=${TMPSIZEMAX}k /tmp
+ fi
+}
+
+start () {
+
+ if [ ! -x $FOP2_SERVER ]; then
+ return
+ fi
+
+ if [ -f /etc/fop2/fop2.cfg ]; then
+ echo "Starting Asterisk FOP2..."
+ $FOP2_SERVER -d -c /etc/fop2 -p $PIDFILE
+ fi
+}
+
+stop () {
+
+ if [ -f $PIDFILE ]; then
+ echo "Stopping Asterisk FOP2..."
+ kill $(cat $PIDFILE) >/dev/null 2>&1
+ rm -f $PIDFILE
+ fi
+}
+
+reload () {
+
+ if [ -f $PIDFILE ]; then
+ echo "Reloading Asterisk FOP2..."
+ kill -HUP $(cat $PIDFILE)
+ fi
+}
+
+case $1 in
+
+start)
+ start
+ ;;
+
+stop)
+ stop
+ ;;
+
+init)
+ init
+ start
+ ;;
+
+restart)
+ stop
+ sleep 2
+ start
+ ;;
+
+reload)
+ reload
+ ;;
+
+*)
+ echo "Usage: start|stop|restart|reload"
+ ;;
+
+esac
+
Property changes on: branches/1.0/package/asterisk-fop2/fop2.init
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: branches/1.0/package/lighttpd/lighttpd.conf
===================================================================
--- branches/1.0/package/lighttpd/lighttpd.conf 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/package/lighttpd/lighttpd.conf 2013-07-12 18:10:44 UTC (rev 6130)
@@ -140,7 +140,7 @@
@CLI_PROXY_SERVER@ )
@CLI_PROXY_SERVER@}
-@PHO...@al... = ( "/phoneprov/" => "/mnt/kd/phoneprov/" )
+@PHO...@al... += ( "/phoneprov/" => "/mnt/kd/phoneprov/" )
@PHONEPROV@
@PHONEPROV@$HTTP["url"] =~ "^/phoneprov/" {
@PHONEPROV@ $HTTP["remoteip"] !~ "^(@PHONEPROV_ALLOW@)$" {
@@ -148,3 +148,5 @@
@PHONEPROV@ }
@PHONEPROV@}
+@FO...@al... += ( "/fop2/" => "/stat/var/packages/fop2/html/" )
+
Modified: branches/1.0/package/lighttpd/lighttpd.init
===================================================================
--- branches/1.0/package/lighttpd/lighttpd.init 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/package/lighttpd/lighttpd.init 2013-07-12 18:10:44 UTC (rev 6130)
@@ -90,6 +90,11 @@
else
phoneprov_allow=".*"
fi
+ if [ -d /stat/var/packages/fop2/html ]; then
+ fop2=""
+ else
+ fop2="#"
+ fi
sed -i -e "s|@HOSTNAME@|${HOSTNAME}|g" \
-e "s|@HTTPDIR@|${httpdir}|g" \
@@ -104,6 +109,7 @@
-e "s|@CLI_PROXY_SERVER@|${cli_proxy_server}|g" \
-e "s|@PHONEPROV@|${phoneprov}|g" \
-e "s!@PHONEPROV_ALLOW@!${phoneprov_allow}!g" \
+ -e "s|@FOP2@|${fop2}|g" \
/tmp/etc/lighttpd.conf
}
Modified: branches/1.0/project/astlinux/target_skeleton/usr/sbin/show-union
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/usr/sbin/show-union 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/project/astlinux/target_skeleton/usr/sbin/show-union 2013-07-12 18:10:44 UTC (rev 6130)
@@ -6,12 +6,14 @@
ASTERISK_SOUNDS="stat/var/lib/asterisk/sounds"
ASTERISK_MOH="stat/var/lib/asterisk/moh"
+PACKAGES="stat/var/packages"
system()
{
find $ASTURW | grep -v -e "^$ASTURW/$KD" \
-e "^$ASTURW/$ASTERISK_SOUNDS" \
- -e "^$ASTURW/$ASTERISK_MOH"
+ -e "^$ASTURW/$ASTERISK_MOH" \
+ -e "^$ASTURW/$PACKAGES"
}
kd()
@@ -37,6 +39,15 @@
fi
}
+packages()
+{
+ if [ -d $ASTURW/$PACKAGES ]; then
+ find $ASTURW/$PACKAGES
+ else
+ echo "No Installed Packages on ASTURW." >&2
+ fi
+}
+
all()
{
find $ASTURW
@@ -63,12 +74,16 @@
asterisk_sounds
;;
+packages)
+ packages
+ ;;
+
all)
all
;;
*)
- echo "Usage: show-union [ system kd asterisk_sounds all ]"
+ echo "Usage: show-union [ system|kd|asterisk_sounds|packages|all ]"
exit 1
;;
Added: branches/1.0/project/astlinux/target_skeleton/usr/sbin/upgrade-package
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/usr/sbin/upgrade-package (rev 0)
+++ branches/1.0/project/astlinux/target_skeleton/usr/sbin/upgrade-package 2013-07-12 18:10:44 UTC (rev 6130)
@@ -0,0 +1,233 @@
+#!/bin/sh
+# red color error message for web interface
+RED=1
+# orange color error message for web interface
+ORANGE=2
+# green color message for web interface
+GREEN=0
+#
+# Base packages directory
+BASE="/stat/var/packages"
+# Lockfile
+LOCKFILE="/var/lock/upgrade-package.lock"
+#
+
+upgrade() {
+ local suffix="${SRC_URL##*.}" tar_args pkg_dir err_str sha1
+
+ case $suffix in
+ tgz|gz) tar_args="-xzf" ;;
+ bz2) tar_args="-xjf" ;;
+ *)
+ finish $RED "Package '$PKG' invalid file suffix: $suffix"
+ ;;
+ esac
+
+ # Create empty temporary directory to download into
+ if [ -d $BASE/dl ]; then
+ rm -rf $BASE/dl
+ fi
+ mkdir -p $BASE/dl
+
+ if ! wget -q -c -O $BASE/dl/$PKG.$suffix.sha1 "$SRC_URL.sha1" >/dev/null; then
+ finish $RED "Package '$PKG' SHA1 download failed."
+ fi
+
+ if [ -f $BASE/$PKG/.sha1 ] && cmp -s $BASE/dl/$PKG.$suffix.sha1 $BASE/$PKG/.sha1; then
+ finish $ORANGE "Package '$PKG' is already installed."
+ fi
+
+ if ! wget -q -c -O $BASE/dl/$PKG.$suffix "$SRC_URL" >/dev/null; then
+ finish $RED "Package '$PKG' download failed."
+ fi
+
+ cd $BASE
+ sha1="$(cat dl/$PKG.$suffix.sha1 | awk '{ print $2; exit; }')"
+ mv dl/$PKG.$suffix dl/${sha1#dl/}
+ if ! sha1sum -cs dl/$PKG.$suffix.sha1; then
+ finish $RED "Package '$PKG' SHA1 verification failed."
+ fi
+ mv dl/${sha1#dl/} dl/$PKG.$suffix
+
+ # Make sure the package is stopped
+ service $PKG stop >/dev/null 2>&1
+
+ if [ -d $BASE/$PKG ]; then
+ if [ -d $BASE/$PKG-OLD ]; then
+ rm -rf $BASE/$PKG-OLD
+ fi
+ mv $BASE/$PKG $BASE/$PKG-OLD
+ fi
+
+ # Create empty temporary directory to untar into
+ if [ -d $BASE/TMP ]; then
+ rm -rf $BASE/TMP
+ fi
+ mkdir $BASE/TMP
+
+ tar $tar_args $BASE/dl/$PKG.$suffix -C $BASE/TMP
+ TAR_ARCHIVE_RTN=$?
+ pkg_dir="$(find $BASE/TMP/* -type d -maxdepth 0 | head -n1)"
+ if [ -n "$pkg_dir" ]; then
+ mv "$pkg_dir" $BASE/$PKG
+ fi
+ rm -rf $BASE/TMP
+ sync
+
+ if [ $TAR_ARCHIVE_RTN -eq 0 ] && [ -d $BASE/$PKG ]; then
+ cp $BASE/dl/$PKG.$suffix.sha1 $BASE/$PKG/.sha1
+ else
+ if [ ! -d $BASE/$PKG ]; then
+ err_str="Package '$PKG' expanded incorrectly"
+ else
+ err_str="Not enough free space for package '$PKG'"
+ rm -rf $BASE/$PKG
+ fi
+ if [ ! -d $BASE/$PKG-OLD ]; then
+ finish $RED "$err_str, '$PKG' is not running."
+ fi
+ mv $BASE/$PKG-OLD $BASE/$PKG
+ finish $RED "$err_str, reverted to previous, '$PKG' is not running."
+ fi
+}
+
+revert() {
+
+ if [ ! -d $BASE/$PKG ]; then
+ finish $RED "Package '$PKG' not installed."
+ fi
+
+ if [ ! -d $BASE/$PKG-OLD ]; then
+ finish $RED "No previous '$PKG' package to revert to."
+ fi
+
+ # Make sure the package is stopped
+ service $PKG stop >/dev/null 2>&1
+
+ mv $BASE/$PKG-OLD $BASE/$PKG-NEW
+ mv $BASE/$PKG $BASE/$PKG-OLD
+ mv $BASE/$PKG-NEW $BASE/$PKG
+}
+
+remove() {
+
+ if [ -d $BASE/$PKG-OLD ]; then
+ rm -rf $BASE/$PKG-OLD
+ fi
+
+ if [ ! -d $BASE/$PKG ]; then
+ finish $RED "Package '$PKG' not installed."
+ fi
+
+ # Make sure the package is stopped
+ service $PKG stop >/dev/null 2>&1
+
+ rm -rf $BASE/$PKG
+}
+
+show() {
+ local str="" pkgs pkg ver IFS
+
+ pkgs="$(find $BASE/* -type d -maxdepth 0 2>/dev/null)"
+ if [ -n "$pkgs" ]; then
+ unset IFS
+ for pkg in $pkgs; do
+ pkg="${pkg##*/}"
+ if [ -f $BASE/$pkg/.sha1 ]; then
+ ver="$(cat $BASE/$pkg/.sha1 | awk '{ print $2; exit; }')"
+ ver="${ver##*/}"
+ ver="${ver%.*}"
+ str="$str${str:+, }$pkg ($ver)"
+ else
+ str="$str${str:+, }$pkg (unknown)"
+ fi
+ done
+ fi
+
+ if [ -z "$str" ]; then
+ PKG_STR="No Packages Installed."
+ else
+ PKG_STR="Installed Packages: $str"
+ fi
+}
+
+finish() {
+
+ trap - INT TERM EXIT
+
+ if [ -d $BASE/dl ]; then
+ rm -rf $BASE/dl
+ fi
+
+ if [ -n "$2" ]; then
+ echo "$2"
+ fi
+ rm -f $LOCKFILE
+ exit $1
+}
+
+# main
+
+if mount | grep -q "/oldroot/mnt/asturw"; then
+ ASTURW="/oldroot/mnt/asturw"
+else
+ echo "Unable to find ASTURW partition."
+ exit $RED
+fi
+
+if [ -f $LOCKFILE ]; then
+ echo "Package Upgrade in Progress, please wait..."
+ exit $ORANGE
+fi
+touch $LOCKFILE
+
+trap 'finish 1 "Aborted"' INT TERM EXIT
+
+PKG="$1"
+
+case $PKG in
+
+fop2)
+ SRC_URL="http://files.astlinux.org/fop2-2.27-debian-i386.tgz"
+ ;;
+
+show)
+ show
+ finish $GREEN "$PKG_STR"
+ ;;
+
+*)
+ echo "Usage: upgrade-package show"
+ finish 1 "Usage: upgrade-package fop2 upgrade|revert|remove [ package_url ]"
+ ;;
+
+esac
+
+shift
+
+case $1 in
+
+upgrade)
+ if [ -n "$2" ]; then
+ SRC_URL=$2
+ fi
+ upgrade
+ finish $GREEN "Successful package '$PKG' upgrade, '$PKG' is not running."
+ ;;
+
+revert)
+ revert
+ finish $GREEN "Successful package '$PKG' revert to previous, '$PKG' is not running."
+ ;;
+
+remove)
+ remove
+ finish $GREEN "Successful package '$PKG' removal."
+ ;;
+
+*)
+ finish 1 "Usage: upgrade-package $PKG upgrade|revert|remove [ package_url ]"
+ ;;
+
+esac
+
Property changes on: branches/1.0/project/astlinux/target_skeleton/usr/sbin/upgrade-package
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: branches/1.0/toolchain/file_exclude
===================================================================
--- branches/1.0/toolchain/file_exclude 2013-07-07 22:25:22 UTC (rev 6129)
+++ branches/1.0/toolchain/file_exclude 2013-07-12 18:10:44 UTC (rev 6130)
@@ -3,3 +3,4 @@
dialog.tar.gz
oui.txt
bfdetect.tar.gz
+fop2-2.27-debian-i386.tgz
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|