Skip to content

Commit

Permalink
Merge branch 'upstream-develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Sep 6, 2022
2 parents 7cddfdf + 8863d00 commit f16ad6b
Show file tree
Hide file tree
Showing 14 changed files with 566 additions and 5 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Close stale issues or PRs'

# Both `issue_comment` and `scheduled` event types are required for this Action
# to work properly.
on:
issue_comment:
types: [created]
schedule:
- cron: '*/5 * * * *'

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
with:
days-before-stale: 14
days-before-close: 7
exempt-all-milestones: true
close-issue-reason: not_planned
only-labels: '❔ User Input'
labels-to-remove-when-unstale: '❔ User Input,💤 Stale'
stale-issue-label: '💤 Stale'
stale-pr-label: '💤 Stale'
stale-issue-message: |
Ahoi!
It looks like there hasn't been any recent updates on
this issue. If you created this issue and no longer
consider it to get merged, then please login to github
and close it. Otherwise, if there is no further activity
on this issue, it will be automatically closedwithin the
next 7 days.
Fair wind and a following sea!
~ Your friendly MainsailGithubBot
*PS: I'm just an automated script, not a real sailor.*
stale-pr-message: |
Ahoi!
It looks like there hasn't been any recent updates on
this pull request. If you created this pull request and
no longer consider it to get merged, then please login
to github and close it. Otherwise, if there is no further
activity on this pull request, it will be automatically
closed within the next 7 days.
Fair wind and a following sea!
~ Your friendly MainsailGithubBot
*PS: I'm just an automated script, not a real sailor.*
4 changes: 2 additions & 2 deletions src/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Shebang for better detection of file type

export DIST_NAME=MainsailOS
export DIST_VERSION=0.7.0
export DIST_VERSION=0.7.1
export BASE_IMAGE_ENLARGEROOT=2500
export MODULES="base,pkgupgrade,mainsailos(network,piconfig,klipper,is_req_preinstall,moonraker,timelapse,mainsail,crowsnest,sonar,password-for-sudo),postrename"
export MODULES="base,pkgupgrade,mainsailos(net,piconfig,klipper,is_req_preinstall,moonraker,timelapse,mainsail,crowsnest,sonar,password-for-sudo),postrename"
export BASE_RELEASE_COMPRESS=yes
export BASE_IMAGE_RESIZEROOT=600
3 changes: 2 additions & 1 deletion src/modules/is_req_preinstall/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# shellcheck disable=all
[ -n "$IS_REQ_PREINSTALL_VENV_DIR" ] || IS_REQ_PREINSTALL_VENV_DIR=/home/${BASE_USER}/klippy-env
[ -n "$IS_REQ_PREINSTALL_DEPS" ] || IS_REQ_PREINSTALL_DEPS="python3-numpy python3-matplotlib"
[ -n "$IS_REQ_PREINSTALL_DEPS" ] || IS_REQ_PREINSTALL_DEPS="python3-numpy python3-matplotlib \
libatlas3-base libatlas-base-dev"
[ -n "$IS_REQ_PREINSTALL_PIP" ] || IS_REQ_PREINSTALL_PIP="numpy<=1.21.4"
[ -n "$IS_REQ_PREINSTALL_CFG_FILE" ] || IS_REQ_PREINSTALL_CFG_FILE="/boot/config.txt"
2 changes: 1 addition & 1 deletion src/modules/moonraker/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install_cleanup_trap

# make sure that this module can be used standalone
apt_update_skip
check_install_pkgs "git virtualenv"
check_install_pkgs "git virtualenv wireless-tools"

echo_green "Installing Moonraker and enable Moonraker Service"
# install MainsailOS premade moonraker.conf
Expand Down
13 changes: 13 additions & 0 deletions src/modules/net/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Network module setup
# shellcheck disable=all

# Use disable power save for wifi module
[ -n "$NETWORK_DISABLE_PWRSAVE" ] || NETWORK_DISABLE_PWRSAVE=yes

# Type of power save rclocal/service/udev
# rclocal - backwards compatibility, runs via rc.local
# service - will add an systemd.service to enable or disable behavior
# on reboots
# udev - creates a udev rules that should affect all wifi devices.

[ -n "$NETWORK_PWRSAVE_TYPE" ] || NETWORK_PWRSAVE_TYPE=udev
163 changes: 163 additions & 0 deletions src/modules/net/filesystem/boot/WiFi-README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
Wifi-README.txt
###############


Due to changes in Raspberry Pi OS, which OS_NAME is based on,
there is no longer a OS_NAME-wpa-supplicant.txt available.

How do I setup a (new) network on my Pi ?
-----------------------------------------

As described in the original Raspberry Pi OS documentation.
See https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-headless-raspberry-pi.


Quote:
You will need to define a wpa_supplicant.conf file for your particular wireless network.
Put this file onto the boot folder of the SD card.
When the Raspberry Pi boots for the first time,
it will copy that file into the correct location in the Linux root file system
and use those settings to start up wireless networking.

The Raspberry Pi’s IP address will not be visible immediately after power on,
so this step is crucial to connect to it headlessly.
Depending on the OS and editor you are creating this on,
the file could have incorrect newlines or the wrong file extension,
so make sure you use an editor that accounts for this.
Linux expects the line feed (LF) newline character.

What does that all mean? What do I have to do now?
----------------------------------------------

First, ensure you have a proper text editor of your choice.
Recommendations are Notepad++, VSCode, Atom or SublimeText.

################################################################################
#### IMPORTANT! ATTENTION! ####
################################################################################

!!!!! HEADS-UP WINDOWS USERS !!!!!
----------------------------------

Do not use Wordpad for editing this file, it will mangle it and your
configuration won't work. Use a proper text editor instead.

!!!!! HEADS-UP MacOS X USERS !!!!!
---------------------------------

If you use Textedit to edit this file make sure to use "plain text format"
and "disable smart quotes" in "Textedit > Preferences", otherwise Textedit
will use none-compatible characters and your network configuration won't work!


1.) Open your chosen text editor and create a new file called

wpa_supplicant.conf

2.) Create a basic configuration. This has to be in place!

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=<Insert 2 letter ISO 3166-1 country code here>
update_config=1

Valid Country Codes are:

GB (United Kingdom)
FR (France)
DE (Germany)
US (United States)
SE (Sweden)

For a full list, please visit https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

2.1) If you plan to use multiple WiFi networks, also add

ap_scan=1

to the mentioned basic configuration.


3.) Setup your "network" block.

For detailed information, please consult:
https://linux.die.net/man/5/wpa_supplicant.conf
or
https://wiki.debian.org/WiFi/HowToUse#wpa_supplicant
or
https://man.archlinux.org/man/wpa_supplicant.conf.5

Examples:

Open or unsecured WiFi network:
-------------------------------

# Open/unsecured
network={
scan_ssid=1 # Used to find hidden SSID's
ssid="put SSID here"
key_mgmt=NONE
}

-------------------------------


WEP "secured" network:
-------------------------------

NOTE:

WEP can be cracked within minutes. If your network is still relying on this
encryption scheme you should seriously consider to update your network ASAP.

network={
ssid="put SSID here"
key_mgmt=NONE
wep_key0="put password here"
wep_tx_keyidx=0
}
--------------------------------


WPA2 Personal secured network:
(Please don't use WPA secured networks, WPA isn't secure anymore)
--------------------------------

# WPA/WPA2 secured
network={
scan_ssid=1 # Used to find hidden SSID's
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
--------------------------------

For the WPA2 Enterprise setup, please use your google-foo.
This is an advanced topic!

4.) Put that file on to the "/boot" partition,
this partition is FAT32 formatted and should be visible if you plug the SD Card into your computer.

If you created a file while the Pi was running, copy that file to boot.
Assuming you created the file in your users "home" directory use

sudo cp -v wpa_supplicant.conf /boot/

5.) Almost done... Please reboot the pi and wait for it to connect.

NOTE:

Attach a screen and watch the console output to get its IP address or
consult your router setup page to grab that information.

You could also try to reach it by its hostname.

http://<yourpisname>.local

If you didnt change the hostname during initial flash, you could use

http://OS_NAME.local

6.) Enjoy OS_NAME :)
15 changes: 15 additions & 0 deletions src/modules/net/filesystem/boot/wpa_supplicant.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Simple configuration for a typical WPA2 network

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US # US Country code

network={
scan_ssid=1
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#### Disable wifi power_save
####
#### Written by Stephan Wendel aka KwadFan <[email protected]>
#### Copyright 2022
#### https://github.com/mainsail-crew/MainsailOS
####
#### This File is distributed under GPLv3
####
#### Note: This is based on:
#### https://www.intel.com/content/www/us/en/support/articles/000006168/boards-and-kits.html

[Unit]
Description=Disable power management for wlan0
After=network.target

[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/usr/local/bin/pwrsave off

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ACTION=="add", \
SUBSYSTEM=="net", \
KERNEL=="wlan*" \
RUN+="/usr/sbin/iw %k set power_save off"
90 changes: 90 additions & 0 deletions src/modules/net/filesystem/usr/local/bin/pwrsave
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/bash
#### Disable wifi power_save
####
#### Written by Stephan Wendel aka KwadFan <[email protected]>
#### Copyright 2022
#### https://github.com/mainsail-crew/MainsailOS
####
#### This File is distributed under GPLv3
####
#### Note: This is based on:
#### https://www.intel.com/content/www/us/en/support/articles/000006168/boards-and-kits.html


## Error handling
set -eou pipefail

## Debug Mode
#set -x

### Message func
function help_msg {
echo -e "Usage:\n"
echo -e "\tpwrsave [ on | off ]"
echo -e "\t\ton\tEnables Power Management of 'wlan0'"
echo -e "\t\toff\tDisables Power Management of 'wlan0'\n"
exit 1
}

function has_wifi {
LC_ALL=C iwconfig wlan0 &> /dev/null && echo "0" || echo "1"
}

function check_wifi_present {
# make sure to exit if command missing
if [ -z "$(command -v iwconfig)" ]; then
echo -e "Command 'iwconfig' not found ... [EXITING]"
exit 1
fi
if [ "$(has_wifi)" != "0" ]; then
echo -e "[ \e[33mWARN\e[0m ] No WiFi hardware present ... [SKIPPED]"
exit 0
fi
}

function disable_pwr_save {
iwconfig wlan0 power off
echo -e "[ \e[32mOK\e[0m ] Disabled Power Management for wlan0"
}


function enable_pwr_save {
iwconfig wlan0 power on
echo -e "[ \e[32mOK\e[0m ] Enabled Power Management for wlan0"
}


### MAIN
function main {
local arg
if [ "$(id -u)" != "0" ]; then
echo -e "\n$(basename "${0}"): This script needs root priviledges!\n"
exit 1
fi
if [ "${#}" == "0" ]; then
echo -e "$(basename "${0}"): No argument set!"
help_msg
fi
if [ "${#}" -gt 1 ]; then
echo -e "$(basename "${0}"): Too many arguments set!"
help_msg
fi
arg="${1}"
case "${arg}" in
"on")
check_wifi_present
enable_pwr_save
;;
"off")
check_wifi_present
disable_pwr_save
;;
?|*)
echo -e "$(basename "${0}"): Unknown argument '${arg}' !"
help_msg
;;
esac
}

main "${@}"
exit 0
Loading

0 comments on commit f16ad6b

Please sign in to comment.