Skip to content

Commit

Permalink
v6.23 (#2729)
Browse files Browse the repository at this point in the history
+ DietPi-Drive_Manager | Preserve encryptfs and vboxsf (VirtualBox shared folder) fstab entries
  • Loading branch information
MichaIng authored Apr 22, 2019
1 parent 36ecc78 commit 184fc76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changes / Improvements / Optimisations:
- DietPi-Benchmark | Increased default survey RootFS and RAM benchmark sizes. 100MB (from 10MB) for RootFS. RAM is 1/4 of available. This is ensure a more accurate calculation of throughput when we divide bytes against time, to obtain the MB/s result.
- DietPi-LetsEncrypt | When applying to Lighttpd, "webroot" authentication is now used instead of "standalone". This allows the auto-renewal service to succeed while Lighttpd is running. Many thanks to @minnux for testing this method: https://github.com/MichaIng/DietPi/issues/2680#issuecomment-480095449
- DietPi-Arr_to_RAM | With v6.18 we silently added a new script that allows linking Sonarr/Radarr/Lidarr database files to RAM, increasing access performance, reducing disk I/O and avoiding constant external HDD spinning due to the very regular access to these files. This script has gone through some rework and polishing and can now be enabled to automatically link those databases to RAM on boot and store them back to disk on shutdown. For more details read: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828. Many thanks to @Dr0bac for providing valuable input and testing the development progress constantly: https://github.com/MichaIng/DietPi/issues/2689
- DietPi-Drive_Manager | encryptfs and vboxsf (VirtualBox shared folder) fstab entries are now preserved. Many thanks to @johnvick and @Phil1988 for suggesting: https://github.com/MichaIng/DietPi/issues/2078, https://github.com/MichaIng/DietPi/issues/2202
- DietPi-Config | G_CHECK_URL: Added ability to change the timeout and retry count, before DietPi URL checking assumes a dead link and failure: https://github.com/MichaIng/DietPi/issues/2717
- DietPi-Config | Serial/UART device handling has been reworked. Serial login consoles can now be toggled for every found serial device individually. On RPi the primary UART can be completely disabled and warnings are prompted if Bluetooth and login console are to be enabled both on ttyAMA0. On update existing systems will be patched so that serial-getty masks and enabled instances are removed if the related serial device does not exist. This solves some error messages during boot.
- DietPi-Config | Network Adapter menu has been cleaned up. Proxy variables are now sourced from "/etc/bashrc.d/dietpi-proxy.sh" and proxy setup outside of DietPi scripts is detected.
Expand Down
38 changes: 19 additions & 19 deletions dietpi/dietpi-drive_manager
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
# Mounts
local swap_mount=''
local tmpfs_mounts=''
local bind_mounts=''
local misc_mounts=''
local net_mounts=''

# Mode 4: Force reset/clean fstab (PREP)
Expand All @@ -142,56 +142,56 @@ tmpfs /DietPi tmpfs defaults,size=10m,noatime,nodev,nosuid,mode=1777 0 0"

swap_mount=$(grep -m1 '[[:blank:]]swap[[:blank:]]' $FP_TEMP_FSTAB)
tmpfs_mounts=$(grep '^tmpfs[[:blank:]]' $FP_TEMP_FSTAB)
bind_mounts=$(grep '[[:blank:],]bind[[:blank:],]' $FP_TEMP_FSTAB)
misc_mounts=$(grep -E '([[:blank:],]bind[[:blank:],]|[[:blank:]](encryptfs|vboxsf)[[:blank:]])' $FP_TEMP_FSTAB)

This comment has been minimized.

Copy link
@Fourdee

Fourdee May 1, 2019

Collaborator

@MichaIng

This causes the following issues, picks up commented lines:

root@TP13:~# grep -E '([[:blank:],]bind[[:blank:],]|[[:blank:]](encryptfs|vboxsf)[[:blank:]])' /etc/fstab
# MISC: encryptfs, vboxsf (VirtualBox shared folder), bind mounts
oot@TP13:~# dietpi-drive_manager 
[  OK  ] DietPi-Drive_Manager | Root access verified.
[ SUB1 ] DietPi-Services > stop
[  OK  ] DietPi-Services | stop : cron
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
0 #debug                                                                                                                                                            
# MISC: encryptfs, vboxsf (VirtualBox shared folder), bind mounts
MISC:
sed: -e expression #1, char 20: unterminated address regex
1 #debug  
2 #debug  
sed: -e expression #1, char 15: unknown command: `0'
3 #debug  

This comment has been minimized.

Copy link
@MichaIng

MichaIng May 1, 2019

Author Owner

@Fourdee
Ah that's true, good find. Was excluded before since "bind" was in parenthesis.

However easy to solve: First non-space character must be not #.

This should fix it: f589b4f

This comment has been minimized.

Copy link
@Fourdee

Fourdee May 1, 2019

Collaborator

@MichaIng

Flipping eck, that was quick!

Nice one 👍

# CurlFtpFS, CIFS/SMB/Samba, NFS
net_mounts=$(grep -E '(^curlftpfs|[[:blank:]]cifs[[:blank:]]|[[:blank:]]nfs[4]?[[:blank:]])' $FP_TEMP_FSTAB)
net_mounts=$(grep -E '(^curlftpfs|[[:blank:]](cifs|nfs[4]?)[[:blank:]])' $FP_TEMP_FSTAB)

fi

echo "#-----------------------------------------------------------
#NETWORK
echo "# Please use \"dietpi-drive_manager\" to setup mounts
#-----------------------------------------------------------
# NETWORK
#-----------------------------------------------------------
#Please use DietPi-Drive_Manager to setup network mounts
$net_mounts
#-----------------------------------------------------------
#TMPFS
# TMPFS
#-----------------------------------------------------------
$tmpfs_mounts
#-----------------------------------------------------------
#MISC (bind)
# MISC: bind, encryptfs, vboxsf (VirtualBox shared folder)
#-----------------------------------------------------------
$bind_mounts
$misc_mounts
#-----------------------------------------------------------
#SWAPFILE
# SWAPFILE
#-----------------------------------------------------------
$swap_mount
#-----------------------------------------------------------
#PHYSICAL DRIVES
# PHYSICAL DRIVES
#-----------------------------------------------------------" > $FP_TEMP_FSTAB

# Detect mounted drives and add them to fstab
G_DIETPI-NOTIFY 2 'Detecting drives, please wait...'
df -Pha | tail -n +2 > .dietpi-drive_manager_df_tmp

# - Remove items from list
# Bind: https://github.com/MichaIng/DietPi/issues/2013#issuecomment-416394374
# Misc: https://github.com/MichaIng/DietPi/issues/2013#issuecomment-416394374
while read line
do

[[ $line ]] || continue

# - Bind
local input_bind_mount_source=$(mawk '{print $1}' <<< $line)
local input_bind_mount_target=$(mawk '{print $2}' <<< $line)
sed -i "\#[[:blank:]]$input_bind_mount_target#d" .dietpi-drive_manager_df_tmp
sed -i "\#[[:blank:]]$input_bind_mount_source#d" .dietpi-drive_manager_df_tmp
[[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 0 " - Detected bind mount and removed from df scrape: $input_bind_mount_source > $input_bind_mount_target"
# - Misc
local input_mount_source=$(mawk '{print $1}' <<< $line)
local input_mount_target=$(mawk '{print $2}' <<< $line)
sed -i "\#^$input_mount_source[[:blank:]]#d" .dietpi-drive_manager_df_tmp
sed -i "\#[[:blank:]]$input_mount_target$#d" .dietpi-drive_manager_df_tmp
[[ $G_DEBUG == 1 ]] && G_DIETPI-NOTIFY 0 " - Detected misc mount and removed from df scrape: $input_mount_source > $input_mount_target"

done <<< "$bind_mounts"
done <<< "$misc_mounts"

# - Process final DF result
while read line
Expand Down

0 comments on commit 184fc76

Please sign in to comment.