Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
outdoorbits committed Dec 30, 2024
1 parent ec98f06 commit 228a207
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
18 changes: 17 additions & 1 deletion install-little-backup-box.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ sudo DEBIAN_FRONTEND=noninteractive \
-o "Dpkg::Options::=--force-confold" \
-o "Dpkg::Options::=--force-confdef" \
install -y -q --allow-downgrades --allow-remove-essential --allow-change-held-packages \
acl git screen rsync exfat-fuse exfatprogs ntfs-3g acl bindfs gphoto2 libimage-exiftool-perl php php-cli samba samba-common-bin vsftpd imagemagick curl libimobiledevice6 ifuse sshpass f3 sqlite3 php-sqlite3 ffmpeg libheif-examples libraw-bin openvpn wireguard openresolv hfsprogs fuse3 python3 python3-pip python3-pil python3-configobj python3-gpiozero python3-rpi-lgpio python3-qrcode smartmontools dos2unix
acl git screen rsync exfat-fuse exfatprogs ntfs-3g acl bindfs gphoto2 libimage-exiftool-perl php php-cli samba samba-common-bin vsftpd imagemagick curl libimobiledevice6 ifuse sshpass f3 sqlite3 php-sqlite3 ffmpeg libheif-examples libraw-bin openvpn wireguard openresolv hfsprogs fuse3 python3 python3-pip python3-pil python3-configobj python3-gpiozero python3-rpi-lgpio python3-qrcode python3-psutil smartmontools dos2unix

# Remove packages not needed anymore
if [ "${SCRIPT_MODE}" = "update" ]; then
Expand Down Expand Up @@ -571,6 +571,22 @@ sudo service vsftpd restart
# setup graphical environment
source "${INSTALLER_DIR}/setup-graphical-environment.sh"

# eth0 settings: use IPv4, not IPv6
# echo "[Unit]
# Description=DHCP Client on eth0
# After=network.target
#
# [Service]
# Type=simple
# ExecStart=/sbin/dhclient -4 -d eth0
# Restart=always
#
# [Install]
# WantedBy=multi-user.target" | sudo tee /etc/systemd/system/dhclient-eth0.service
#
# sudo systemctl enable dhclient-eth0
# sudo systemctl start dhclient-eth0

# install comitup
if [ "${SCRIPT_MODE}" = "install" ] || [ "${CHOICE_COMITUP}" = "0" ]; then

Expand Down
9 changes: 3 additions & 6 deletions scripts/displaymenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
import lib_cron_ip
import lib_language
import lib_network
import lib_setup
import lib_storage
import lib_system

import lib_debug
xxx = lib_debug.debug()
# import lib_debug
# xx = lib_debug.debug()

class MENU_CONTROLLER(object):
def __init__(self):
Expand Down Expand Up @@ -512,9 +513,6 @@ def move_left(self):

##debug
if __name__ == "__main__":
xxx.d('start')
import lib_setup

setup=lib_setup.setup()

menu_controller = MENU_CONTROLLER()
Expand All @@ -541,4 +539,3 @@ def move_left(self):
#menuobj.move_right(0)#debug
#menuobj.move_right(0)#debug
# time.sleep(20)
xxx.d('End.')
18 changes: 7 additions & 11 deletions scripts/lib_comitup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@

import base64
import os
import psutil
import subprocess
import sys

import lib_display
import lib_language
import lib_setup

# import lib_debug
# xx=lib_debug.debug()

class comitup(object):
def __init__(self):
Expand Down Expand Up @@ -80,20 +83,13 @@ def new_status(self, status):
for Port in BasicPorts:
f.write(f'Listen {Port}\n')

if len(sys.argv) > 1:
if status == 'CONNECTED':
f.write(f'Listen 80\n')
if not self.check_hotspot():
f.write(f'Listen 80\n')

subprocess.run('service apache2 restart || service apache2 start', shell=True)

def check_hotspot(self):
try:
if '10.41.0.1' in subprocess.check_output(['sudo', 'ifconfig']).decode():
return('active')
else:
return('inactive')
except:
return('Error')
return(len([p for p in psutil.process_iter() if 'comitup-web' in p.name()]) > 0)

def reset(self):
subprocess.run(['sudo', 'comitup-cli', 'd'])
Expand Down Expand Up @@ -124,7 +120,7 @@ def reset(self):
comitup().new_status(Status)

elif Mode == '--check_hotspot':
print(comitup().check_hotspot())
print('active' if comitup().check_hotspot() else 'inactive')

elif Mode == '--reset':
comitup().reset()

0 comments on commit 228a207

Please sign in to comment.