Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timeout from install.sh #166

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MANIFEST_URL="${MANIFEST_URL:-https://github.com/webosbrew/webos-homebrew-channe
export MANIFEST_URL

echo "[ ] Downloading manifest..."
export MANIFEST_JSON="$(curl -L $MANIFEST_URL)"
export MANIFEST_JSON="$(curl -L -- "$MANIFEST_URL")"

export $(node -e '
var manifest = JSON.parse(process.env.MANIFEST_JSON);
Expand All @@ -16,19 +16,25 @@ console.info("IPK_SHA256=" + manifest.ipkHash.sha256);
')

echo "[ ] Downloading $IPK_URL..."
curl -L $IPK_URL -o /tmp/hbchannel.ipk
curl -L -o /tmp/hbchannel.ipk -- "$IPK_URL"
echo "$IPK_SHA256 /tmp/hbchannel.ipk" | sha256sum -c

rm -rf /tmp/luna-install
mkfifo /tmp/luna-install
echo "[ ] Installing..."
luna-send-pub -i 'luna://com.webos.appInstallService/dev/install' '{"id":"com.ares.defaultName","ipkUrl":"/tmp/hbchannel.ipk","subscribe":true}' >/tmp/luna-install &
luna-send-pub -w 15000 -i 'luna://com.webos.appInstallService/dev/install' '{"id":"com.ares.defaultName","ipkUrl":"/tmp/hbchannel.ipk","subscribe":true}' >/tmp/luna-install &
LUNA_PID=$!
result="$(timeout -t 15 egrep -i -m 1 'installed|failed' /tmp/luna-install || echo timeout)"
kill -term $LUNA_PID

if ! result="$(fgrep -m 1 -e 'installed' -e 'failed' /tmp/luna-install)"; then
rm /tmp/luna-install
echo "[!] Install timed out"
exit 1
fi

kill -TERM "$LUNA_PID" 2>/dev/null || true
rm /tmp/luna-install

case $result in
case "$result" in
*installed*) ;;
*)
echo "[!] Install failed - $result"
Expand Down
Loading