Check-in [1a9a8b1256]
Overview
Comment:Set path to include the path to appfsd in appfs-cache
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1a9a8b1256c7449a29c8153ee37b97b54a0b7895
User & Date: rkeene on 2019-12-13 00:06:08
Other Links: manifest | tags
Context
2019-12-13
00:06
Upgrade to latest kitcreator in static builder check-in: 7c1528d686 user: rkeene tags: trunk
00:06
Set path to include the path to appfsd in appfs-cache check-in: 1a9a8b1256 user: rkeene tags: trunk
00:03
Support loading an existing key when generating a CA Cert check-in: ac33419083 user: rkeene tags: trunk
Changes

Modified appfs-cache from [c1af76ad48] to [dae13120c1].

    18     18   # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    19     19   # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    20     20   # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    21     21   # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    22     22   # THE SOFTWARE.
    23     23   #
    24     24   
           25  +PATH="${PATH}:$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
           26  +
    25     27   appfsd_options=()
    26     28   if [ "$1" == "--cachedir" ]; then
    27     29   	appfsd_options=("${appfsd_options[@]}" '--cachedir' "$2")
    28     30   
    29     31   	shift; shift;
    30     32   fi
    31     33   
................................................................................
    42     44   
    43     45   	site="$1"
    44     46   
    45     47   	call_appfsd --sqlite3 'DELETE FROM sites WHERE hostname = '"'$site'"'; DELETE FROM packages WHERE hostname = '"'$site'"';' || return 1
    46     48   
    47     49   	clean
    48     50   }
           51  +
           52  +function mirror() {
           53  +	local site destinationDir
           54  +	local baseURL index
           55  +	local packageList
           56  +
           57  +	local marker
           58  +
           59  +	site="$1"
           60  +	destinationDir="$2"
           61  +
           62  +	baseURL="http://${site}/appfs"
           63  +	index="${baseURL}/index"
           64  +
           65  +	if [ ! -e "${destinationDir}" ]; then
           66  +		mkdir "${destinationDir}" || return 1
           67  +	fi
           68  +
           69  +	marker="$(openssl rand 20 -hex)"
           70  +
           71  +	(
           72  +		cd "${destinationDir}" || exit 1
           73  +
           74  +		# XXX:TODO: This does not validate the signature
           75  +		curl -sSL "${index}" > "index.${marker}"
           76  +
           77  +		packageListHash="$(cat "index.${marker}" | cut -f 1 -d ,)"
           78  +		packageListHashMethod="$(cat "index.${marker}" | cut -f 2 -d ,)"
           79  +		#curl -sSL "${...}"
           80  +
           81  +		mv "index.${marker}" index
           82  +	) || return 1
           83  +
           84  +	return 0
           85  +}
    49     86   
    50     87   function clean() {
    51     88   	call_appfsd --tcl "$(cat <<\_EOF_
    52     89   		unset -nocomplain row
    53     90   		::appfs::db eval {SELECT sha1, hostname FROM packages;} row {
    54     91   			set hostname [::appfs::db onecolumn {SELECT hostname FROM sites WHERE hostname = $row(hostname) LIMIT 1;}]
    55     92   			if {$hostname == ""} {
................................................................................
   123    160   			ln -fs "${packagedir}"/lib/* /lib/
   124    161   		fi
   125    162   	done
   126    163   
   127    164   	return 0
   128    165   }
   129    166   
   130         -case "$1" in
          167  +operation="$1"
          168  +shift
          169  +case "$operation" in
   131    170   	install)
   132         -		shift
   133    171   		install "$@" || exit 1
   134    172   		exit 0
   135    173   		;;
   136    174   	invalidate)
   137    175   		invalidate || exit 1
   138    176   		;;
   139    177   	remove-site)
   140         -		remove_site "$2" || exit 1
          178  +		remove_site "$@" || exit 1
   141    179   		;;
   142    180   	clean)
   143    181   		clean || exit 1
   144    182   		;;
   145    183   	clear)
   146         -		clear "$2" || exit 1
          184  +		clear "$@" || exit 1
          185  +		;;
          186  +	hoard)
          187  +		echo "not implemented" >&2
          188  +		exit 1
          189  +
          190  +		hoard "$@" || exit 1
          191  +		exit 0
          192  +		;;
          193  +	mirror)
          194  +		echo "not implemented" >&2
          195  +		exit 1
          196  +
          197  +		mirror "$@" || exit 1
          198  +		exit 0
   147    199   		;;
   148    200   	*)
   149         -		echo "Usage: appfs-cache {invalidate|clean|clear|clear <package>|remove-site <site>}" >&2
          201  +		echo "Usage: appfs-cache {invalidate|clean|clear|clear <package>|remove-site <site>|hoard <package>|mirror <site> <dir>}" >&2
   150    202   
   151    203   		exit 1
   152    204   		;;
   153    205   esac
   154    206   
   155    207   pkill -HUP appfsd
   156    208   
   157    209   exit 0