blob: d09f7fdbefb1e8e735fccc9ae46ecba062ccdc77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
base="/var/www/localhost/htdocs/alpine"
#release=$(readlink $base/latest-stable)
release="edge"
repos="main testing"
archs="x86 x86_64 armhf"
output="output.csv"
database="filelist.db"
create_filelist() {
local apk="$1" repo="$2" arch="$3"
local filelist=$(tar --exclude ".*" -ztf "$apk")
local filename="${apk##*/}"
local pkgname="${filename%-*-*}"
oIFS=$IFS
IFS=$'\n'
for item in $filelist; do
file="${item##*/}"
path="${item%/*}"
case "$file" in
*,*) file="\"$file\"" ;;
esac
case "$path" in
*,*) path="\"$path\"" ;;
esac
[ ! -z "$file" ] && \
echo "$file,$path,$pkgname,$repo,$arch" >> $output
done
IFS=$oIFS
}
rm -f $output $database
printf "CREATE TABLE filelist(file varchar(255), path text, pkgname varchar(255), repo varchar(8), arch varchar(8));" | sqlite3 $database
for repo in $repos; do
for arch in $archs; do
printf "Starting: $repo/$arch"
for apk in $base/$release/$repo/$arch/*.apk; do
printf .
create_filelist "$apk" "$repo" "$arch"
done
done
done
printf ".mode csv\n.import $output filelist" | sqlite3 $database
|