-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from sharkwouter/master
Add repo index pages
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>${GITHUB_REPOSITORY_OWNER}'s package index</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<p><h1>${GITHUB_REPOSITORY_OWNER}'s package index</h1></p> | ||
<table> | ||
<tr><th>Name</th><th>Version</th><th>Description</th><th>Last Updated</th></tr> | ||
${INDEX_TABLE_CONTENT} | ||
</table> | ||
<p>Source on <a href="https://github.com/${GITHUB_REPOSITORY}/">GitHub</a></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
#Change directory to the directory of this script | ||
cd "$(dirname "$0")" | ||
|
||
# Export all variables | ||
set -a | ||
|
||
# Fail on error | ||
set -e | ||
|
||
# Set global variables | ||
GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-pspdev}" | ||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-pspdev/pspdev}" | ||
INDEX_TABLE_CONTENT="" | ||
|
||
# Build the html pages | ||
for PSPBUILD in $(find . -name "PSPBUILD" | sort); do | ||
source "${PSPBUILD}" | ||
UPDATED=$(git log -1 --format=%cd --date=short -- "${PSPBUILD}") | ||
DOWNLOAD_URL="${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.gz" | ||
|
||
# Convert lists to strings | ||
ARCH="${arch[*]}" | ||
LICENSE="${license[*]}" | ||
|
||
# Get file size info | ||
FILENAME="repo/${DOWNLOAD_URL}" | ||
if [ -f "${FILENAME}" ]; then | ||
PKGSIZE="$(ls -l "${FILENAME}"|cut -d' ' -f5|numfmt --to iec --suffix=B --format "%.1f")" | ||
INSTSIZE="$(gunzip -c "${FILENAME}"|grep -a '^size = '|cut -d' ' -f3|numfmt --to iec --suffix=B --format "%.1f")" | ||
fi | ||
|
||
# List dependencies | ||
if [ ! -n "${depends[*]}" ]; then | ||
DEPS="No dependencies" | ||
else | ||
DEPS="<ul>" | ||
for dep in "${depends[@]}"; do | ||
DEPS="${DEPS}<li><a href=\"${dep}.html\">${dep}</a></li>" | ||
done | ||
DEPS="${DEPS}</ul>" | ||
fi | ||
|
||
# List content of files | ||
if [ -f "${FILENAME}" ]; then | ||
CONTENT="<ul>" | ||
for item in $(tar -tzf $FILENAME | grep -v '\.BUILDINFO\|\.MTREE\|\.PKGINFO\|/$'); do | ||
CONTENT="${CONTENT}<li>${item}</li>" | ||
done | ||
CONTENT="${CONTENT}</ul>" | ||
else | ||
CONTENT="Not known" | ||
fi | ||
|
||
envsubst < package.html > "repo/${pkgname}.html" | ||
|
||
INDEX_TABLE_CONTENT="${INDEX_TABLE_CONTENT}<tr><td><a href=\"${pkgname}.html\">${pkgname}</a></td><td>${pkgver}-${pkgrel}</td><td>${pkgdesc}</td><td>${UPDATED}</td></tr>" | ||
done | ||
|
||
envsubst < index.html > repo/index.html | ||
cp style.css repo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>${pkgname} - ${GITHUB_REPOSITORY_OWNER}'s package index</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<p><h1>${GITHUB_REPOSITORY_OWNER}'s package index</h1></p> | ||
<p><h2>${pkgname} ${pkgver}-${pkgrel}</h2></p> | ||
|
||
<p> | ||
<b>Architecture:</b> ${ARCH}</br> | ||
<b>Description:</b> ${pkgdesc}</br> | ||
<b>Upstream URL:</b> <a href="${url}">${url}</a></br> | ||
<b>License:</b> ${LICENSE}</br> | ||
<b>Last Updated:</b> ${UPDATED}</br> | ||
<b>Package Size:</b> ${PKGSIZE}</br> | ||
<b>Installed Size:</b> ${INSTSIZE}</br> | ||
<b>Download:</b> <a href="${DOWNLOAD_URL}">${DOWNLOAD_URL}</a></br> | ||
</p> | ||
|
||
<p><h3>Dependencies</h3></p> | ||
<p>${DEPS}</p> | ||
|
||
<p><h3>Contents</h3></p> | ||
<p>${CONTENT}</p> | ||
|
||
<p><a href="index.html">Back to index</a></p> | ||
|
||
<p>Source on <a href="https://github.com/${GITHUB_REPOSITORY}/">GitHub</a></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
body { | ||
font-family: sans-serif; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
font-size: 0.9em; | ||
} | ||
|
||
table tbody tr { | ||
border-bottom: 1px solid #dddddd; | ||
} | ||
|
||
table th, td { | ||
padding: 12px 15px; | ||
} | ||
|
||
table tbody tr:nth-of-type(even) { | ||
background-color: #f3f3f3; | ||
} | ||
|
||
table tbody tr:nth-of-type(uneven) { | ||
background-color: #009879; | ||
} |