Skip to content

Commit

Permalink
Merge pull request MichaIng#2393 from Fourdee/clear_conf
Browse files Browse the repository at this point in the history
General | Clean and remove /DietPi/dietpi/conf
  • Loading branch information
Fourdee authored Jan 5, 2019
2 parents 17ef979 + 20d124f commit d7d7545
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 91 deletions.
File renamed without changes.
8 changes: 6 additions & 2 deletions .conf/dps_51/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
# - Starts X if not already running
#
# Usage:
# /DietPi/dietpi/conf/opentyrian_run
# run
#////////////////////////////////////

#Xserver already running
if (($(pidof X) >= 0)); then

/usr/local/games/opentyrian/opentyrian -t /usr/local/games/opentyrian/data

#No X (init X server)
else

xinit /usr/local/games/opentyrian/opentyrian -t /usr/local/games/opentyrian/data
fi

fi
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changes / Improvements / Optimisations:
- DietPi-Software | MPD: Now runs as "mpd" user again, updated systemd unit to match official one and better handle existing cache and log files on reinstall: https://github.com/Fourdee/DietPi/issues/2378
- DietPi-Update | Added optional ability to automatically update DietPi, when updates are available. Please note, this is disabled by default.
- DietPi-Sync | Removed the compression option, which has no effect on local sync, since files are not stored compressed, but only transferred compressed through remote sync protocols, which are currently not offered by DietPi-Sync.
- General | Moved the remaining conf/* files located on DietPi-RAMdisk to /var/lib/dietpi or into DietPi-PREP, and removed /DietPi/dietpi/conf completely. These files were only used once or never, thus have no business inside the RAMdisk.

Bug Fixes:
- DietPi-Software | Nextcloud: Resolved an issue, where the Nextcloud Apache config was not downloaded correctly. Thanks to @Stefan3v for reporting this issue: https://github.com/Fourdee/DietPi/issues/2383
Expand Down
43 changes: 37 additions & 6 deletions PREP_SYSTEM_FOR_DIETPI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1082,9 +1082,10 @@ _EOF_
#-----------------------------------------------------------------------------------
#Cron Jobs

G_DIETPI-NOTIFY 2 'Configuring Cron'
G_DIETPI-NOTIFY 2 'Configuring Cron:'

cat << _EOF_ > /etc/crontab
G_ERROR_HANDLER_COMMAND='/etc/crontab'
cat << _EOF_ > $G_ERROR_HANDLER_COMMAND
# Please use dietpi-cron to change cron start times
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
Expand All @@ -1096,6 +1097,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
47 1 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 1 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
_EOF_
G_ERROR_HANDLER_EXITCODE=$?
G_ERROR_HANDLER

#-----------------------------------------------------------------------------------
#Network
Expand Down Expand Up @@ -1148,11 +1151,39 @@ _EOF_

/DietPi/dietpi/func/dietpi-obtain_hw_model

G_DIETPI-NOTIFY 2 'Configuring Network:'
G_DIETPI-NOTIFY 2 'Configuring network interfaces:'

[[ -f /etc/network/interfaces ]] && rm -R /etc/network/interfaces # armbian symlink for bulky network-manager
[[ -f /etc/network/interfaces ]] && rm -R /etc/network/interfaces # ARMbian symlink for bulky network-manager

G_RUN_CMD cp /DietPi/dietpi/conf/network_interfaces /etc/network/interfaces
G_ERROR_HANDLER_COMMAND='/etc/network/interfaces'
cat << _EOF_ > $G_ERROR_HANDLER_COMMAND
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.
# Local
auto lo
iface lo inet loopback
# Ethernet
#allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# Wifi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#dns-nameservers 8.8.8.8 8.8.4.4
_EOF_
G_ERROR_HANDLER_EXITCODE=$?
G_ERROR_HANDLER

# - Remove all predefined eth*/wlan* adapter rules
rm -f /etc/udev/rules.d/70-persist*nt-net.rules
Expand Down Expand Up @@ -1193,7 +1224,7 @@ _EOF_

echo 'DietPi' > /etc/hostname

G_DIETPI-NOTIFY 2 'Configuring htop'
G_DIETPI-NOTIFY 2 'Configuring htop:'

G_ERROR_HANDLER_COMMAND='/etc/htoprc'
cat << _EOF_ > $G_ERROR_HANDLER_COMMAND
Expand Down
24 changes: 0 additions & 24 deletions dietpi/conf/network_interfaces

This file was deleted.

54 changes: 21 additions & 33 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

#Grab Inputs
# - target MENU INDEX (valid interger)
disable_error=1 G_CHECK_VALIDINT $1 && TARGETMENUID=$1
disable_error=1 G_CHECK_VALIDINT "$1" && TARGETMENUID=$1

# - Exit DietPi-Config when going back to previous menu?
if disable_error=1 G_CHECK_VALIDINT $2; then
if disable_error=1 G_CHECK_VALIDINT "$2"; then

EXITONBACK=$2
TEXT_MENU_BACK='Exit'
Expand Down Expand Up @@ -170,24 +170,18 @@
Menu_Exit(){

# TARGETMENUID = -1 , if we are to exit the menu

G_WHIP_SIZE_X_MAX=50
if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then

TARGETMENUID=-1

#Disable reboot when run from dietpi-software
# Disable reboot when run from dietpi-software
pgrep 'dietpi-software' &> /dev/null && REBOOT_REQUIRED=0

# Reboot required
if (( $REBOOT_REQUIRED )); then

G_WHIP_YESNO 'A reboot is required to apply your new settings.\nWould you like to reboot now?'
(( $? == 0 )) && reboot

fi
(( $REBOOT_REQUIRED )) && G_WHIP_YESNO 'A reboot is required to apply your new settings.\nWould you like to reboot now?' && reboot

#Return to DietPiConfig main menu
# Return to DietPi-Config main menu
elif (( $EXITONBACK == 0 )); then

TARGETMENUID=0
Expand Down Expand Up @@ -252,25 +246,25 @@

else

G_WHIP_MENU_ARRAY+=('1' ': Change Resolution')
G_WHIP_MENU_ARRAY+=('1' ': Display Resolution')

# Just offer resolution option for VMs
# On VM, only offer resolution option
if (( $G_HW_MODEL != 20 )); then

G_WHIP_MENU_ARRAY+=('2' ': GPU/RAM Memory Split')
local lcdpanel_text=$(grep -m1 '^[[:blank:]]*CONFIG_LCDPANEL=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
G_WHIP_MENU_ARRAY+=('3' ": LCD Panel addon: [$lcdpanel_text]")
G_WHIP_MENU_ARRAY+=('3' ": LCD Panel addon: [${lcdpanel_text:-NONE}]")

fi

fi

local xorg_dpi_current=$(grep -m1 '^[[:blank:]]*SOFTWARE_XORG_DPI=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
G_WHIP_MENU_ARRAY+=('17' ": Xorg DPI: [$xorg_dpi_current]")

#Display brightness
G_WHIP_MENU_ARRAY+=('16' ': Display Brightness')

local xorg_dpi_current=$(grep -m1 '^[[:blank:]]*SOFTWARE_XORG_DPI=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
G_WHIP_MENU_ARRAY+=('17' ": X.Org DPI: [${xorg_dpi_current:-N/A}]")

(( $G_HW_MODEL != 20 )) && G_WHIP_MENU_ARRAY+=('14' ': LED Control')

#RPi only
Expand All @@ -283,7 +277,7 @@

local hdmi_boost_current=$(grep -m1 '[[:blank:]]*config_hdmi_boost=' /DietPi/config.txt | sed 's/^[^=]*=//')
local hdmi_boost_text="[$hdmi_boost_current]"
(( ! $hdmi_boost_current )) && hdmi_boost_text='[Off]'
(( $hdmi_boost_current )) || hdmi_boost_text='[Off]'

local rpi_camera_module_enabled=$(grep -ci -m1 '^[[:blank:]]*start_x=1' /DietPi/config.txt)
local rpi_camera_module_text='[Off]'
Expand Down Expand Up @@ -367,13 +361,13 @@

if (( $G_WHIP_RETURNED_VALUE == 15 )); then

for i in "${!overscan_options[@]}"
for i in "${overscan_options[@]}"
do

G_WHIP_DEFAULT_ITEM="$i"
if G_WHIP_INPUTBOX "Please enter a value (pixel count) for ${overscan_options[$i]}.\n - EG: 16"; then
G_WHIP_DEFAULT_ITEM=${!i}
if G_WHIP_INPUTBOX "Please enter a value (pixel count) for $i\n - EG: 16"; then

sed -i "/${overscan_options[$i]}=/c ${overscan_options[$i]}=$G_WHIP_RETURNED_VALUE" /DietPi/config.txt
sed -i "/$i=/c $i=$G_WHIP_RETURNED_VALUE" /DietPi/config.txt
REBOOT_REQUIRED=1

else
Expand Down Expand Up @@ -4320,8 +4314,7 @@ Additional benchmarks:

)

G_WHIP_MENU 'Please select an option:'
if (( $? == 0 )); then
if G_WHIP_MENU 'Please select an option:'; then

#Return to this menu
TARGETMENUID=15
Expand Down Expand Up @@ -4396,11 +4389,11 @@ Additional benchmarks:
# - Check if system supports temp readouts
local cpu_supports_temp=0
local cpu_temp=$(G_OBTAIN_CPU_TEMP)
disable_error=1 G_CHECK_VALIDINT $cpu_temp && cpu_supports_temp=1
disable_error=1 G_CHECK_VALIDINT "$cpu_temp" && cpu_supports_temp=1

# - Loop until stress completed
local remaning_time=0
while ps aux | grep -qi '[s]tress'
while pgrep 'stress' &> /dev/null
do

cpu_temp=$(G_OBTAIN_CPU_TEMP)
Expand Down Expand Up @@ -4471,7 +4464,7 @@ Additional benchmarks:
noip_menutext='Enter/Setup NoIp Details'

#Check if noip is running (indicates login details are valid)
if ps aux | grep -qi '/usr/local/bin/[n]oip2'; then
if pgrep '/usr/local/bin/noip2' &> /dev/null; then

noip_status='Online / Active'
noip_menutext='Change NoIp Details'
Expand Down Expand Up @@ -4686,12 +4679,7 @@ NB: If you need to use *.pool.ntp.org servers, enter the base domain only. The s

local noip_url_address=''
G_WHIP_YESNO 'NoIp Client is not installed, would you like to install it now?\n\n- NoIp will allow you to use a fixed web address, regardless of your internet IP\neg: MySuperDooperWebsite.noip2.biz would point to this device!'
if (( $? == 0 )); then

#Install
/DietPi/dietpi/dietpi-software install 67

fi
(( $? == 0 )) && /DietPi/dietpi/dietpi-software install 67

else

Expand Down
4 changes: 2 additions & 2 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -8384,7 +8384,7 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal

# - default config
G_BACKUP_FP /etc/mpd.conf
cp /DietPi/dietpi/conf/mpd.conf /etc/mpd.conf
dps_index=$software_id Download_Install 'mpd.conf' /etc/mpd.conf
# On Stretch (custom build), symlink /etc/mpd.conf to /usr/local/etc/mpd.conf, where /usr/local/bin/mpd by default searches
if (( $G_DISTRO == 4 )); then

Expand Down Expand Up @@ -8670,7 +8670,7 @@ _EOF_
mkdir -p $HOME/.config/cava

G_BACKUP_FP $HOME/.config/cava/config
cp /DietPi/dietpi/conf/cava.conf $HOME/.config/cava/config
cp /var/lib/dietpi/dietpi-software/conf/cava.conf $HOME/.config/cava/config

# - lower MPD buffer size to reduce latency of spectrum:
sed -i '/audio_buffer_size /c\audio_buffer_size "384"' /etc/mpd.conf
Expand Down
2 changes: 1 addition & 1 deletion dietpi/dietpi-update
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Do you wish to continue and update DietPi to v$COREVERSION_SERVER.$SUBVERSION_SE
rm DietPi-"$GITBRANCH_TARGET"/dietpi/pre-patch_file

#Remove folders of "non-critical scripts" before updating them. (eg: so we dont need to patch for /conf/* file removals)
# rm -R /DietPi/dietpi/conf #:https://github.com/Fourdee/DietPi/issues/905#issuecomment-298241622
# :https://github.com/Fourdee/DietPi/issues/905#issuecomment-298241622
# rm -R /DietPi/dietpi/func
# rm -R /DietPi/dietpi/misc

Expand Down
2 changes: 1 addition & 1 deletion dietpi/misc/dietpi-justboom
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
MPD_AUDIO_BUFFER_SIZE=2048

# - Reset CAVA config
cp /DietPi/dietpi/conf/cava.conf $HOME/.config/cava/config
cp /var/lib/dietpi/dietpi-software/conf/cava.conf $HOME/.config/cava/config

CAVA_ENABLED=1
CAVA_FRAMERATE=30
Expand Down
34 changes: 12 additions & 22 deletions dietpi/patch_file
Original file line number Diff line number Diff line change
Expand Up @@ -652,19 +652,15 @@ _EOF_
(( $G_DIETPI_INSTALL_STAGE == 2 )) && /DietPi/dietpi/dietpi-software reinstall 23 27 28 34 119 120 137
#-------------------------------------------------------------------------------
#Initially allow non-root users to obtain network details as well: https://github.com/Fourdee/DietPi/commit/15c0d495c33d3091e219c87bb2d09a22f8d27e9c
[[ -f /DietPi/dietpi/.network ]] && chmod 666 /DietPi/dietpi/.network
[[ -f /boot/dietpi/.network ]] && chmod 666 /boot/dietpi/.network
chmod -f 666 /{DietPi,boot}/dietpi/.network
#-------------------------------------------------------------------------------
#Re-Run set uid for sudo: https://github.com/Fourdee/DietPi/issues/794#issuecomment-392335392
chmod 4755 $(which sudo)
#-------------------------------------------------------------------------------
#Removal due to changed file locations: https://github.com/Fourdee/DietPi/pull/1802
rm /DietPi/dietpi/func/dietpi-set_core_environment &> /dev/null
rm /boot/dietpi/func/dietpi-set_core_environment &> /dev/null
rm /DietPi/dietpi/conf/cron.daily_dietpi &> /dev/null
rm /boot/dietpi/conf/cron.daily_dietpi &> /dev/null
rm /DietPi/dietpi/conf/cron.hourly_dietpi &> /dev/null
rm /boot/dietpi/conf/cron.hourly_dietpi &> /dev/null
rm -f /{DietPi,boot}/dietpi/func/dietpi-set_core_environment
rm -f /{DietPi,boot}/dietpi/conf/cron.daily_dietpi
rm -f /{DietPi,boot}/dietpi/conf/cron.hourly_dietpi
rm /var/lib/dietpi/fs_partition_resize.sh &> /dev/null
rm /var/lib/dietpi/dietpi-software/services/kill-ssh-user-sessions-before-network.sh &> /dev/null
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -721,12 +717,7 @@ _EOF_
fi
#-------------------------------------------------------------------------------
#Remove config.txt for non-RPi devices: https://github.com/Fourdee/DietPi/pull/1863
if (( $G_HW_MODEL >= 10 )); then

[[ -f /DietPi/config.txt ]] && rm /DietPi/config.txt
[[ -f /boot/config.txt ]] && rm /boot/config.txt

fi
(( $G_HW_MODEL >= 10 )) && rm -f /{DietPi,boot}/config.txt
#-------------------------------------------------------------------------------
#Removal of NTP from dietpi-software
sed -i '/^aSOFTWARE_INSTALL_STATE\[106\]=/c\aSOFTWARE_INSTALL_STATE\[106\]=0' /DietPi/dietpi/.installed &> /dev/null
Expand Down Expand Up @@ -763,7 +754,7 @@ _EOF_
elif (( $G_DIETPI_VERSION_SUB == 10 )); then

#-------------------------------------------------------------------------------
echo 0 &> /dev/null
:
#-------------------------------------------------------------------------------

elif (( $G_DIETPI_VERSION_SUB == 11 )); then
Expand Down Expand Up @@ -844,9 +835,7 @@ _EOF_
fi

sed -i '/[[:space:]]\/var\/log[[:space:]]/d' /etc/fstab
cat << _EOF_ >> /etc/fstab
tmpfs /var/log tmpfs defaults,size=${var_log_size_new}m,noatime,nodev,nosuid,mode=1777 0 0
_EOF_
echo "tmpfs /var/log tmpfs defaults,size=${var_log_size_new}m,noatime,nodev,nosuid,mode=1777 0 0" >> /etc/fstab

fi
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1365,7 +1354,7 @@ You will not face any practical differences, since both services start the same
for i in "${!afp_config_remove[@]}"
do

rm /DietPi/dietpi/conf/${afp_config_remove[$i]} /boot/dietpi/conf/${afp_config_remove[$i]} &> /dev/null
rm -f /{DietPi,boot}/dietpi/conf/${afp_config_remove[$i]}

done

Expand Down Expand Up @@ -1491,11 +1480,12 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix
# - dietpi-unsupported_terminal.sh: https://github.com/Fourdee/DietPi/issues/2347
[[ -f /etc/profile.d/dietpi-unsupported_terminal.sh ]] && rm /etc/profile.d/dietpi-unsupported_terminal.sh
# - Possible leftover from PREP:
[[ -f /DietPi/dietpi/pre-patch_file ]] && rm /DietPi/dietpi/pre-patch_file
[[ -f /boot/dietpi/pre-patch_file ]] && rm /boot/dietpi/pre-patch_file
rm -f /{DietPi,boot}/dietpi/pre-patch_file
# - dietpi/conf removal from RAMdisk: https://github.com/Fourdee/DietPi/pull/2393
rm -Rf /{DietPi,boot}/dietpi/conf
#-------------------------------------------------------------------------------
#.dietpi-autostart_index removal, if zero: https://github.com/Fourdee/DietPi/pull/2343
[[ -f /DietPi/dietpi/.dietpi-autostart_index ]] && (( $(</DietPi/dietpi/.dietpi-autostart_index) == 0 )) && rm /DietPi/dietpi/.dietpi-autostart_index && [[ -f /boot/dietpi/.dietpi-autostart_index ]] && rm /boot/dietpi/.dietpi-autostart_index
[[ -f /DietPi/dietpi/.dietpi-autostart_index ]] && (( $(</DietPi/dietpi/.dietpi-autostart_index) == 0 )) && rm -f /{DietPi,boot}/dietpi/.dietpi-autostart_index
#-------------------------------------------------------------------------------
#Resolve networking service order cycle on Jessie: https://github.com/Fourdee/DietPi/pull/2357#issuecomment-448276505
if (( $G_DISTRO < 4 )); then
Expand Down
File renamed without changes.

0 comments on commit d7d7545

Please sign in to comment.