Skip to content

Commit

Permalink
clear badboots on install, wait for server for 120 seconds and make a…
Browse files Browse the repository at this point in the history
… log if it fails
  • Loading branch information
unknown321 committed Jan 19, 2025
1 parent 1fd70b3 commit 1d404dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions installer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ log()
IFS=$oldIFS
}

clearBadBoots() {
if ! test -f /contents/wampy/config.ini; then
log "no previous config found"
return
fi

log "badboots = $(busybox grep badboots /contents/wampy/config.ini)"
log "resetting badboots to 0"
busybox sed -i 's/badboots.*/badboots = 0/g' /contents/wampy/config.ini
log "badboots = $(busybox grep badboots /contents/wampy/config.ini)"
}

install() {
log "installing ${BINARY}"
mkdir -p ${VENDOR}/bin/
Expand Down Expand Up @@ -109,6 +121,8 @@ install() {
log "installing llusbdac"
mkdir -p ${VENDOR}/modules/
cp llusbdac.ko ${VENDOR}/modules/

clearBadBoots
}

log "installing $(cat product_info)"
Expand Down
7 changes: 7 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ int main(int, char **) {
exit(1);
}

auto now = std::time(nullptr);
while (true) {
struct stat st {};
if (stat(socket.c_str(), &st) == 0) {
Expand All @@ -431,6 +432,12 @@ int main(int, char **) {
nanosleep(&tw, nullptr);
DLOG("waiting for socket %s\n", socket.c_str());
}

if (std::time(nullptr) - now > 120) {
DLOG("wampy socket timeout, %s\n", socket.c_str());
createDump();
exit(1);
}
}

connector->Start();
Expand Down

0 comments on commit 1d404dc

Please sign in to comment.