xref: /haiku/3rdparty/mmu_man/scripts/identify_repo.sh (revision 0754c319592cd8a523959d85fb06ab23c64a98a6)
1*0754c319SFrançois Revol#!/bin/bash
2*0754c319SFrançois Revol
3*0754c319SFrançois Revol# for each package in /system/packages/ check which repository it comes from
4*0754c319SFrançois Revol
5*0754c319SFrançois Revol# actually reverse video
6*0754c319SFrançois Revol#bold=`tput smso`
7*0754c319SFrançois Revol#offbold=`tput rmso`
8*0754c319SFrançois Revol
9*0754c319SFrançois Revol# show only not found
10*0754c319SFrançois Revolonf=0
11*0754c319SFrançois Revolif [ "x$1" == "x-n" ]; then
12*0754c319SFrançois Revolonf=1
13*0754c319SFrançois Revolfi
14*0754c319SFrançois Revol
15*0754c319SFrançois Revolcd /system/packages/
16*0754c319SFrançois Revol
17*0754c319SFrançois Revolrepos=""
18*0754c319SFrançois Revolfor r in /system/settings/package-repositories/*; do
19*0754c319SFrançois Revol	repos="$repos ${r##*/}"
20*0754c319SFrançois Revol	u=`sed '/^url=/s/url=//g;q' "$r"`
21*0754c319SFrançois Revol	urls="$urls $u"
22*0754c319SFrançois Revoldone
23*0754c319SFrançois Revolreponames=($repos)
24*0754c319SFrançois Revolrepourls=($urls)
25*0754c319SFrançois Revol
26*0754c319SFrançois Revolfor p in *.hpkg; do
27*0754c319SFrançois Revol	#echo "$p"
28*0754c319SFrançois Revol	i=0
29*0754c319SFrançois Revol	found=0
30*0754c319SFrançois Revol	while [ $i -lt ${#reponames[@]} ]; do
31*0754c319SFrançois Revol		#echo "Checking repo ${reponames[$i]}..."
32*0754c319SFrançois Revol		#echo "${repourls[$i]}"
33*0754c319SFrançois Revol		if wget -q --spider "${repourls[$i]}/packages/$p" ; then
34*0754c319SFrançois Revol			[ "$onf" == 1 ] || echo "$p in ${reponames[$i]}";
35*0754c319SFrançois Revol			found=1
36*0754c319SFrançois Revol			break
37*0754c319SFrançois Revol		fi
38*0754c319SFrançois Revol		let i=i+1
39*0754c319SFrançois Revol	done
40*0754c319SFrançois Revol	if [ $found != 1 ]; then
41*0754c319SFrançois Revol		echo "${bold}$p NOT FOUND${offbold}"
42*0754c319SFrançois Revol	fi
43*0754c319SFrançois Revoldone
44