Skip to content

Commit

Permalink
Beta v6.31.0 (#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaIng committed Jun 28, 2020
2 parents 24fbf54 + e1c88c3 commit 75b2b0b
Show file tree
Hide file tree
Showing 43 changed files with 1,615 additions and 1,364 deletions.
27 changes: 27 additions & 0 deletions .conf/dps_2/config.xml
@@ -0,0 +1,27 @@
<config>
<!-- Configuration: Do not create a config backup on each change -->
<config-rotate v='false'/>

<!-- HTTP Server: Allow remote access -->
<allow v='0/0'/>

<!-- Logging: Minimal logs to "journalctl -u fahclient" only -->
<log v='/dev/null'/>
<log-rotate v='false'/>
<log-time v='false'/>
<verbosity v='0'/>

<!-- Slot Control: Do not start folding right after install -->
<paused v='true'/>

<!-- User Information: Fold as user "DietPi" for team "DietPi" -->
<passkey v='06c869246e88c00cb05cc4d1758a97f9'/>
<team v='234437'/>
<user v='DietPi'/>

<!-- Web Server: Allow remote web UI access -->
<web-allow v='0/0'/>

<!-- Folding Slots: Enable GPU slots if supported -->
<gpu v='true'/>
</config>
13 changes: 10 additions & 3 deletions .conf/dps_93/apache.pihole.conf
@@ -1,8 +1,15 @@
# If the URL starts with /admin, it is the Web interface
# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian

# Admin panel
<Directory ~ /var/www(/html)?/admin>
# Create a response header for debugging using curl -I
# Create response header for Pi-hole debugger
Header set X-Pi-hole "The Pi-hole Web interface is working!"
Header set X-Frame-Options "deny"
Header set X-Frame-Options "DENY"

# Allow access to local fonts
<Files ~ "\.(eot|otf|tt[cf]|woff2?)$">
Header set Access-Control-Allow-Origin "*"
</Files>

# Block . files from being served, such as .git, .github, .gitignore
<Files ~ "^\.">
Expand Down
12 changes: 5 additions & 7 deletions .conf/dps_93/lighttpd.pihole.conf
@@ -1,15 +1,15 @@
# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian

# If the URL starts with /admin, it is the Web interface
# Admin panel
$HTTP["url"] =~ "^(/html)?/admin/" {
# Create a response header for debugging using curl -I
# Create response header for Pi-hole debugger
setenv.add-response-header = (
"X-Pi-hole" => "The Pi-hole Web interface is working!",
"X-Frame-Options" => "DENY"
)

$HTTP["url"] =~ "\.ttf$" {
# Allow Block Page access to local fonts
# Allow admin panel access to local fonts
$HTTP["url"] =~ "\.(eot|otf|tt[cf]|woff2?)$" {
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
}
}
Expand All @@ -19,11 +19,9 @@ $HTTP["url"] =~ "^(/html)?/admin/\." {
url.access-deny = ("")
}

# If it's a request to Pi-hole blocking page...
# Block public access to blocking page
$HTTP["url"] =~ "^(/html)?/pihole/" {
# ... and the request isn't local
$HTTP["remoteip"] !~ "^1(27|92\.168|0|72\.(1[6-9]|2[0-9]|3[0-1]))\." {
# block!
url.access-deny = ("")
}
}
Expand Down
15 changes: 13 additions & 2 deletions .conf/dps_93/nginx.pihole.conf
@@ -1,16 +1,26 @@
# Based on: https://github.com/pi-hole/pi-hole/blob/master/advanced/lighttpd.conf.debian

# Admin panel
location ~ ^(?:/html|)/admin(?:$|/) {
# Block public access to admin page, if enabled
# - To enable: cd /etc/nginx/sites-dietpi; mv dietpi-pihole-block_public_admin.off dietpi-pihole-block_public_admin.on
# - To disable: cd /etc/nginx/sites-dietpi; mv dietpi-pihole-block_public_admin.on dietpi-pihole-block_public_admin.off
include sites-dietpi/dietpi-pihole-block_public_admin.*on;

# Block . files from being served, such as .git, .github, .gitignore
location ~ ^(?:/html|)/admin/\. {
deny all;
}
# Create a response header for debugging using curl -I

# Create response header for Pi-hole debugger
add_header X-Pi-hole "The Pi-hole Web interface is working!";
add_header X-Frame-Options "DENY";

# Allow access to local fonts
location ~ \.(?:eot|otf|tt[cf]|woff2?)$ {
add_header Access-Control-Allow-Origin "*";
}

# Standard PHP handler block
try_files $uri $uri/ =404;
location ~ ^(?:/html|)/admin/.+\.php(?:$|/) {
Expand All @@ -21,12 +31,13 @@ location ~ ^(?:/html|)/admin(?:$|/) {

# Blocking page
location ~ ^(?:/html|)/pihole(?:$|/) {
# Block public access to blocking page by default
# Block public access to blocking page
allow 127.0.0.0/8;
allow 192.168.0.0/16;
allow 10.0.0.0/8;
allow 172.16.0.0/12;
deny all;

# Standard PHP handler block
try_files $uri $uri/ =404;
location ~ ^(?:/html|)/pihole/.+\.php(?:$|/) {
Expand Down
2 changes: 1 addition & 1 deletion .conf/dps_96/conf
Expand Up @@ -29,7 +29,7 @@
comment = DietPi Share
path = /mnt/dietpi_userdata
browseable = yes
create mask = 0775
create mask = 0664
directory mask = 0775
valid users = dietpi
writeable = yes
Expand Down
100 changes: 44 additions & 56 deletions .meta/dietpi-fan_control
Expand Up @@ -33,7 +33,7 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.

# Import DietPi-Globals ---------------------------------------------------------------
. /boot/dietpi/func/dietpi-globals
export G_PROGRAM_NAME='DietPi-Fan_control'
G_PROGRAM_NAME='DietPi-Fan_control'
G_CHECK_ROOT_USER
G_INIT
# Import DietPi-Globals ---------------------------------------------------------------
Expand All @@ -60,15 +60,15 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.

# Grab valid input
INPUT=0
if [[ $@ ]]; then
if [[ $* ]]; then

if disable_error=1 G_CHECK_VALIDINT "$@"; then
if disable_error=1 G_CHECK_VALIDINT "$*"; then

INPUT=$@
INPUT=$*

else

G_DIETPI-NOTIFY 1 "Invalid input argument ($@) found. Aborting...\n$AVAIABLE_COMMANDS"
G_DIETPI-NOTIFY 1 "Invalid input argument ($*) found. Aborting...\n$AVAIABLE_COMMANDS"
exit 1

fi
Expand All @@ -81,38 +81,37 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.
# Read currently applied fan control values
Read_Control_Files(){

# - Read current fan control toggle
# Read current fan control toggle
TEMP_CONTROLLED_CURRENT=$(<$FP_TEMP_CONTROLLED)

# - Read current trip point temperatures, assuming values of CPU0 for all CPUs
local fp_target=''
local i=0
TRIP_TEMPS_CURRENT=''
# Read current trip point temperatures, assuming values of CPU0 for all CPUs
local fp_target i=0
TRIP_TEMPS_CURRENT=
for fp_target in /sys/devices/virtual/thermal/thermal_zone0/trip_point_*_temp
do

# - Convert "XY000" to XY°C
# Convert "XY000" to XY°C
TRIP_TEMPS_CURRENT+=" $(( $(</sys/devices/virtual/thermal/thermal_zone0/trip_point_${i}_temp) / 1000 ))"
((i++))

done
# - Remove leading white space
# Remove leading white space
TRIP_TEMPS_CURRENT=${TRIP_TEMPS_CURRENT# }

# - Read current trip point fan speeds
TRIP_SPEEDS_CURRENT=''
# Read current trip point fan speeds
TRIP_SPEEDS_CURRENT=
for i in $(<$FP_TRIP_SPEEDS)
do

# - Convert 0-255 to 0-100%
# Convert 0-255 to 0-100%
TRIP_SPEEDS_CURRENT+=" $(( $i * 100 / 255 ))"

done
# - Remove leading white space
# Remove leading white space
TRIP_SPEEDS_CURRENT=${TRIP_SPEEDS_CURRENT# }

# - Read current static fan speed
# - Convert 0-255 to 0-100%
# Read current static fan speed
# - Convert 0-255 to 0-100%
STATIC_SPEED_CURRENT=$(( $(<$FP_STATIC_SPEED) * 100 / 255 ))

}
Expand All @@ -127,17 +126,17 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.
# Verify valid settings, before applying
Verify_Settings(){

# - $TEMP_CONTROLLED is expected to be either 0 or 1.
if ! [[ $TEMP_CONTROLLED == 0 || $TEMP_CONTROLLED == 1 ]]; then
# $TEMP_CONTROLLED is expected to be either 0 or 1.
if [[ $TEMP_CONTROLLED != [01] ]]; then

G_DIETPI-NOTIFY 1 "Invalid setting: \$TEMP_CONTROLLED=$TEMP_CONTROLLED"
return 1

elif (( $TEMP_CONTROLLED )); then

# - $TRIP_SPEEDS and $TRIP_TEMPS are expected to follow scheme: [0-9]+[[:blank:]][0-9]+...
# - $TRIP_TEMPS need to match than $TRIP_POINT_COUNT: Amount of actual CPU0 thermal zone control files
# - $TRIP_SPEEDS values need to be exactly one more: Min speed + one each temp trip
# $TRIP_SPEEDS and $TRIP_TEMPS are expected to follow scheme: [0-9]+[[:blank:]][0-9]+...
# $TRIP_TEMPS need to match than $TRIP_POINT_COUNT: Amount of actual CPU0 thermal zone control files
# $TRIP_SPEEDS values need to be exactly one more: Min speed + one each temp trip
if ! [[ $TRIP_TEMPS =~ ^[0-9[:blank:]]+$ && $TRIP_SPEEDS =~ ^[0-9[:blank:]]+$ ]] ||
! (( $(wc -w <<< "$TRIP_TEMPS") == $TRIP_POINT_COUNT && $(wc -w <<< "$TRIP_SPEEDS") == $TRIP_POINT_COUNT + 1 )); then

Expand All @@ -146,10 +145,10 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.

fi

elif (( ! $TEMP_CONTROLLED )); then
else

# - $STATIC_SPEED is expected to be an integer.
if ! disable_error=1 G_CHECK_VALIDINT $STATIC_SPEED; then
# $STATIC_SPEED is expected to be an integer.
if ! disable_error=1 G_CHECK_VALIDINT "$STATIC_SPEED"; then

G_DIETPI-NOTIFY 1 "Invalid setting: \$STATIC_SPEED=$STATIC_SPEED"
return 1
Expand All @@ -166,12 +165,12 @@ dietpi-fan_control 1 => Non-interactively apply settings from $FP_SETTINGS.
# Write settings to file
Write_Settings(){

# - Write fan control toggle to settings file
# Write fan control toggle to settings file
echo "TEMP_CONTROLLED=$TEMP_CONTROLLED" > $FP_SETTINGS

if (( $TEMP_CONTROLLED )); then

# - Write trip points and attached temperatures to settings file
# Write trip points and attached temperatures to settings file
cat << _EOF_ >> $FP_SETTINGS
TRIP_TEMPS='$TRIP_TEMPS'
TRIP_SPEEDS='$TRIP_SPEEDS'
Expand Down Expand Up @@ -200,10 +199,8 @@ _EOF_
local i=0

# Apply trip point temps
local j=0
local temp=0
local fp_target=''
for (( i=0; i<$G_HW_CPU_CORES; i++ ))
local j=0 temp=0 fp_target
for ((i=0; i<$G_HW_CPU_CORES; i++))
do

j=0
Expand All @@ -223,7 +220,7 @@ _EOF_
done

# Apply trip point fan speeds
local trip_speeds_target=
local trip_speeds_target
for i in $TRIP_SPEEDS
do

Expand All @@ -250,8 +247,7 @@ _EOF_
#-----------------------------------------------------------------------------------
Reset_Menu(){

G_WHIP_YESNO 'Reset fan control settings\n\nYour fan control settings file will be removed and current selections purged. This will take effect after next reboot.\n\nDo you want to continue?'
if (( ! $? )); then
if G_WHIP_YESNO 'Reset fan control settings\n\nYour fan control settings file will be removed and current selections purged. This will take effect after next reboot.\n\nDo you want to continue?'; then

[[ -f $FP_SETTINGS ]] && G_EXEC_DESC="Removing $FP_SETTINGS" G_EXEC rm $FP_SETTINGS
G_EXEC_DESC='Resetting current selections' G_EXEC unset TEMP_CONTROLLED TRIP_TEMPS TRIP_SPEEDS STATIC_SPEED
Expand Down Expand Up @@ -299,18 +295,18 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_

Main_Menu(){

local i=''
local i

# Read currently applied fan controls, to generate status message
Read_Control_Files
local whip_message=''
local whip_message

if (( $TEMP_CONTROLLED_CURRENT )); then

# - Current control mode
# Current control mode
whip_message+='Mode: Temperature controlled'

# - Current trip point temps
# Current trip point temps
whip_message+='\nTemp points: '
for i in $TRIP_TEMPS_CURRENT
do
Expand All @@ -319,7 +315,7 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_

done

# - Current trip point speeds
# Current trip point speeds
whip_message+='\nFan speeds:'
for i in $TRIP_SPEEDS_CURRENT
do
Expand All @@ -330,15 +326,15 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_

else

# - Current control mode
# Current control mode
whip_message+='Mode: Static fan speed'

# - Static fan speed
# Static fan speed
whip_message+="\nFan speed: ${STATIC_SPEED_CURRENT}%"

fi

# - Control mode setting
# Control mode setting
TEMP_CONTROLLED=${TEMP_CONTROLLED:-$TEMP_CONTROLLED_CURRENT}
local mode_text='Static fan speed'
(( $TEMP_CONTROLLED )) && mode_text='Temperature controlled'
Expand All @@ -351,9 +347,9 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_

if (( $TEMP_CONTROLLED )); then

# - Trip point temperature settings
# Trip point temperature settings
TRIP_TEMPS=${TRIP_TEMPS:-$TRIP_TEMPS_CURRENT}
local trip_temps_text=''
local trip_temps_text
for i in $TRIP_TEMPS
do

Expand All @@ -362,9 +358,9 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_
done
G_WHIP_MENU_ARRAY+=( 'Temp points' "Selected: $trip_temps_text" )

# - Trip point speed settings
# Trip point speed settings
TRIP_SPEEDS=${TRIP_SPEEDS:-$TRIP_SPEEDS_CURRENT}
local trip_speeds_text=''
local trip_speeds_text
for i in $TRIP_SPEEDS
do

Expand Down Expand Up @@ -392,15 +388,7 @@ EG: To run the fan at 50%, enter\n \"60\"" && STATIC_SPEED=$G_WHIP_RETURNED_

elif [[ $G_WHIP_RETURNED_VALUE == 'Mode' ]]; then

if (( $TEMP_CONTROLLED )); then

TEMP_CONTROLLED=0

else

TEMP_CONTROLLED=1

fi
(( $TEMP_CONTROLLED )) && TEMP_CONTROLLED=0 || TEMP_CONTROLLED=1

elif [[ $G_WHIP_RETURNED_VALUE == 'Temp points' ]]; then

Expand Down

0 comments on commit 75b2b0b

Please sign in to comment.