File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,12 +39,23 @@ ok "Repository updated"
3939log " Building application"
4040swift build -c release -v 2>&1 | grep -E " Compiling|Linking|Build complete|error:" || true
4141BIN_PATH=$( swift build -c release --show-bin-path)
42+
43+ # Determine cached binary name (matches install-swift-app naming)
44+ PLATFORM=$( dpkg --print-architecture)
45+ OS_ID=$( . /etc/os-release && echo " ${ID}${VERSION_ID} " | tr -d ' .' )
46+ SWIFT_VERSION=$( swift --version 2>&1 | grep -oE ' [0-9]+\.[0-9]+\.[0-9]+' | head -1)
47+ APP_VERSION=$( grep -oE ' version = "[0-9]+\.[0-9]+\.[0-9]+"' " $INSTALL_DIR /Sources/App/info.swift" 2> /dev/null | grep -oE ' "[^"]*"' | tr -d ' "' )
48+ APP_VERSION=" ${APP_VERSION:- unknown} "
49+ BIN_NAME=" App-${OS_ID} -${PLATFORM} -swift-${SWIFT_VERSION} -${APP_VERSION} "
50+
4251log " Stopping service"
4352# Delay so client could read the "Stopping service" message before the service is stopped and the connection is lost
4453sleep 2
4554systemctl stop " $APP_NAME "
46- cp " $BIN_PATH /App" " $INSTALL_DIR /App"
47- chown $APP_USER :$APP_USER " $INSTALL_DIR /App"
55+ cp " $BIN_PATH /App" " $INSTALL_DIR /$BIN_NAME "
56+ cp " $INSTALL_DIR /$BIN_NAME " " $INSTALL_DIR /App"
57+ chown $APP_USER :$APP_USER " $INSTALL_DIR /$BIN_NAME " " $INSTALL_DIR /App"
58+ ok " Binary cached as $BIN_NAME "
4859setcap ' cap_net_bind_service=+ep' " $INSTALL_DIR /App" # Allow binding to port 443 without root
4960ok " Binary updated"
5061
You can’t perform that action at this time.
0 commit comments