Skip to content

Commit 1213d66

Browse files
committed
upadte gpt5
1 parent 1b87679 commit 1213d66

File tree

4 files changed

+44
-36
lines changed

4 files changed

+44
-36
lines changed

platforms/common/overlays/etc/systemd/system/runtipios-hotspot.service

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Description=RuntipiOS WiFi Hotspot (only if no Ethernet)
33
After=network-online.target systemd-networkd-wait-online.service
44
Wants=network-online.target
5-
Conflicts=wpa_supplicant@wlan0.service
5+
# Stop these when hotspot runs to avoid conflicts
6+
Conflicts=wpa_supplicant@wlan0.service NetworkManager.service dnsmasq.service
67
ConditionPathExists=!/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
78

89
[Service]
@@ -13,7 +14,7 @@ ExecStartPre=/bin/sleep 10
1314
ExecStartPre=/bin/bash -c 'echo "=== runtipios-hotspot starting ===" >> /tmp/runtipios-hotspot.log'
1415
ExecStart=/usr/local/bin/runtipios-hotspot start
1516
ExecStop=/usr/local/bin/runtipios-hotspot stop
16-
TimeoutStartSec=60
17+
TimeoutStartSec=90
1718
# Don't restart if it exits (Ethernet detected)
1819
Restart=no
1920

platforms/common/overlays/usr/local/bin/runtipi-install

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ RUNTIPI_DIR="$HOME/runtipi"
55
INSTALL_FLAG="$HOME/.runtipi-installed"
66
LOG_FILE="/tmp/runtipi-install.log"
77

8+
# Ensure we run in the user's home and have a sane environment
9+
cd "$HOME" || cd /
10+
export DEBIAN_FRONTEND=noninteractive
11+
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
12+
813
# Function to log with timestamp
914
log() {
1015
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOG_FILE"
@@ -52,6 +57,13 @@ log "This may take 10-30 minutes depending on your connection..."
5257
log "Installation log: $LOG_FILE"
5358

5459
# Download and run installer with error handling
60+
if command -v curl >/dev/null 2>&1; then
61+
log "curl found"
62+
else
63+
log "ERROR: curl is not installed"
64+
exit 1
65+
fi
66+
5567
if curl -fsSL https://setup.runtipi.io -o /tmp/runtipi-installer.sh 2>>"$LOG_FILE"; then
5668
log "Installer downloaded successfully"
5769
log "Running installation script..."

platforms/common/overlays/usr/local/bin/runtipios-hotspot

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ start_hotspot() {
6464
rfkill unblock wifi 2>/dev/null || true
6565

6666
# Stop conflicting services
67-
log "Stopping conflicting services..."
67+
log "Stopping conflicting services (wpa_supplicant, dnsmasq, NetworkManager, dhcpcd)..."
6868
systemctl stop wpa_supplicant@wlan0 2>/dev/null || true
69+
systemctl stop dnsmasq 2>/dev/null || true
70+
systemctl stop NetworkManager 2>/dev/null || true
6971
systemctl stop dhcpcd 2>/dev/null || true
7072

7173
# Kill any existing processes
7274
killall wpa_supplicant 2>/dev/null || true
75+
killall dnsmasq 2>/dev/null || true
7376
killall dhcpcd 2>/dev/null || true
7477

7578
# Configure interface
@@ -83,6 +86,10 @@ start_hotspot() {
8386

8487
log "Interface configured with IP ${SUBNET}.1"
8588

89+
# Mark hotspot as active for other components (e.g., captive portal)
90+
mkdir -p /run/runtipios
91+
echo on > /run/runtipios/hotspot.active
92+
8693
# Configure hostapd
8794
log "Configuring hostapd..."
8895
cat > /etc/hostapd/hostapd.conf << EOF
@@ -157,23 +164,9 @@ EOF
157164
log "Password: $PASSWORD"
158165
log "Web portal: http://${SUBNET}.1"
159166

160-
# Keep running (don't exit)
167+
# Keep running (don't exit) - minimal heartbeat loop
161168
log "Hotspot is running. Press Ctrl+C or stop service to exit."
162-
163-
# Wait indefinitely (service type=simple requires this)
164-
while true; do
165-
sleep 60
166-
# Check if hostapd is still running
167-
if ! pgrep hostapd > /dev/null; then
168-
log "ERROR: hostapd process died, restarting..."
169-
hostapd -B /etc/hostapd/hostapd.conf 2>&1 | tee -a "$LOG_FILE"
170-
fi
171-
# Check if dnsmasq is still running
172-
if ! pgrep dnsmasq > /dev/null; then
173-
log "ERROR: dnsmasq process died, restarting..."
174-
dnsmasq --conf-file=/etc/dnsmasq.d/hotspot.conf 2>&1 | tee -a "$LOG_FILE"
175-
fi
176-
done
169+
while sleep 60; do :; done
177170
}
178171
}
179172

@@ -186,6 +179,7 @@ stop_hotspot() {
186179
rm -f /etc/dnsmasq.d/hotspot.conf
187180
ip addr flush dev $INTERFACE 2>/dev/null || true
188181
ip link set dev $INTERFACE down 2>/dev/null || true
182+
rm -f /run/runtipios/hotspot.active
189183
log "Hotspot stopped"
190184
}
191185

scripts/customize.sh

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ apt-get install -y --no-install-recommends \
8686
dnsmasq \
8787
lighttpd \
8888
iptables \
89+
rfkill \
8990
iw \
9091
wireless-tools \
9192
curl \
@@ -279,29 +280,29 @@ configure_boot() {
279280
╔═══════════════════════════════════════════════════════════════╗
280281
║ Welcome to RuntipiOS! ║
281282
║ ║
282-
║ Lightweight Linux distribution for running Runtipi ║
283+
║ Lightweight Linux distribution for running Runtipi
283284
║ ║
284-
║ Default login: runtipi / runtipi ║
285+
║ Default login: runtipi / runtipi
285286
║ ║
286-
║ Runtipi will install automatically when internet is ║
287-
║ detected (Ethernet or WiFi). ║
287+
║ Runtipi will install automatically when internet is
288+
║ detected (Ethernet or WiFi).
288289
║ ║
289-
║ TROUBLESHOOTING: ║
290-
║ Run: debug (shows complete diagnostic) ║
290+
║ TROUBLESHOOTING:
291+
║ Run: debug (shows complete diagnostic)
291292
║ ║
292-
║ Access web interface after installation: ║
293-
║ http://runtipios.local ║
294-
║ http://YOUR_IP_ADDRESS ║
293+
║ Access web interface after installation:
294+
║ http://runtipios.local
295+
║ http://YOUR_IP_ADDRESS
295296
║ ║
296-
║ WiFi Setup (if no Ethernet): ║
297-
║ 1. Hotspot should appear: RuntipiOS-Setup ║
298-
║ 2. Password: runtipios2024 ║
299-
║ 3. Configure WiFi via web portal ║
300-
║ 4. Runtipi installs automatically after connection ║
297+
║ WiFi Setup (if no Ethernet):
298+
║ 1. Hotspot should appear: RuntipiOS-Setup
299+
║ 2. Password: runtipios2024
300+
║ 3. Configure WiFi via web portal
301+
║ 4. Runtipi installs automatically after connection
301302
║ ║
302-
║ Check status: ║
303-
║ systemctl status runtipios-hotspot ║
304-
║ systemctl status runtipi-install ║
303+
║ Check status:
304+
║ systemctl status runtipios-hotspot
305+
║ systemctl status runtipi-install
305306
║ ║
306307
╚═══════════════════════════════════════════════════════════════╝
307308
EOF

0 commit comments

Comments
 (0)