#!/bin/sh # kishan@hackorama.com http://www.hackorama.com 2003 # # Demo Application Launcher Shellscript # which will pop up the license file # on the first run by a user. # # Uses a $HOME/.dot-file for persistance # # Stores the version string in the same # .dot-file to support multiple versions of # the same application without creating # separate .dot-files for each version. # # kishan@hackorama.com http://www.hackorama.com 2003 #uncomment for debugging #set -x # # CHECK THE LICENSE BEFORE LAUNCHING YOUR APP # # # this is the flag file which will hold the version string # license_flag_file=$HOME/.foobar-license # # the file containing the license text # license_text=LICENSE # # this is the unique version string for each version # license_version="1.2.1.01" # # By default license will be shown ... # show_license=1 # # ... unless the flg file exist and if it has a # matching version, then continue without showing. # if test -f "$license_flag_file"; then grep $license_version $license_flag_file > /dev/null versionflag=$? if [ $versionflag = 0 ] then show_license=0 fi fi if [ $show_license = 1 ] then more $license_text agreed= while [ x$agreed = x ]; do echo echo "Do you agree to the above license terms ? [yes or no] " read answer leftover case $answer in yes | Yes | YES ) agreed=1 echo "$license_version" >> $license_flag_file ;; no | No | NO ) echo " " echo "You have not accepted the Software License Agreement. Exiting" echo " " exit 1;; esac done fi # LUNCH YOUR APPLICATION HERE echo "" echo "Starting foobar" echo ""