Skip to content

Commit

Permalink
Merge pull request #2195 from Fourdee/dev
Browse files Browse the repository at this point in the history
Dev > Beta
  • Loading branch information
Fourdee authored Oct 28, 2018
2 parents 55f6a0d + 5895363 commit 0816374
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ v6.18
(xx/11/18)

Changes / Improvements / Optimisations:
- General | Concurrent execution detection: Now has a 5 second buffer to wait for exit (G_INIT_WAIT_CONCURRENT), before failing: https://github.com/Fourdee/DietPi/issues/2159#issuecomment-433619721

Bug Fixes:
- PREP: Resolved failed rootFS resize: https://github.com/Fourdee/DietPi/issues/2181#issuecomment-433715556
- DietPi-Software | Nextcloud: Resolved an issue with failed installation: https://github.com/Fourdee/DietPi/issues/2184
- DietPi-Automation | CONFIG_NTP_MODE is now applied after APT cache, and, initial time sync is updated. Due to packages required for some modes: https://github.com/Fourdee/DietPi/issues/2181#issuecomment-433444882
- DietPi-Software | OMPD/MyMPD: Resolved inability to update database. Currently we have rolled back the versions of these programs to a working state. We will investigate with the devs to find out the cause for future release: https://github.com/Fourdee/DietPi/issues/2156
Expand Down
22 changes: 18 additions & 4 deletions dietpi/func/dietpi-globals
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,28 @@ _EOF_
#INIT functions for originating script
# - Stuff we can't init in main globals/funcs due to /etc/bashrc.d/ load into current session.
G_INIT_ALLOW_CONCURRENT=${G_INIT_ALLOW_CONCURRENT:-0}
G_INIT_WAIT_CONCURRENT=${G_INIT_WAIT_CONCURRENT:-5}
G_INIT(){

# Check for concurrent execution
if (( ! $G_INIT_ALLOW_CONCURRENT )); then

local timer=0

while [[ -d /tmp/$G_PROGRAM_NAME ]]
do

G_WHIP_BUTTON_OK_TEXT='Retry'
if ! G_WHIP_YESNO "WARNING: Concurrent execution of $G_PROGRAM_NAME detected.\n
if (( $timer < $G_INIT_WAIT_CONCURRENT )); then

G_DIETPI-NOTIFY 2 "Concurrent execution of $G_PROGRAM_NAME detected: Retry ($timer/$G_INIT_WAIT_CONCURRENT), please wait..."

sleep 1
((timer++))

else

G_WHIP_BUTTON_OK_TEXT='Retry'
if ! G_WHIP_YESNO "WARNING: Concurrent execution of $G_PROGRAM_NAME detected.\n
Please check if one of the following applies:
- This script already runs on another terminal/SSH session.
- Currently a cron or systemd background job executes the script.
Expand All @@ -151,8 +163,10 @@ Please assure that the concurrent execution has finished, before retrying, other
The following info might help:
$(ps f -eo pid,user,tty,cmd | grep -i [d]ietpi)"; then

G_DIETPI-NOTIFY 1 "Canceled $G_PROGRAM_NAME due to concurrent execution"
exit 1
G_DIETPI-NOTIFY 1 "Canceled $G_PROGRAM_NAME due to concurrent execution"
exit 1

fi

fi

Expand Down
11 changes: 4 additions & 7 deletions rootfs/var/lib/dietpi/services/fs_partition_resize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TARGET_DEV=$(findmnt / -o source -n)
if [[ $TARGET_DEV =~ /mmcblk || $TARGET_DEV =~ /nvme ]]; then

TARGET_PARTITION=${TARGET_DEV##*p} # Last [0-9] after "p"
TARGET_DRIVE=${TARGET_DRIVE%p[0-9]} # EG: /dev/mmcblk[0-9]
TARGET_DRIVE=${TARGET_DEV%p[0-9]} # EG: /dev/mmcblk[0-9]

elif [[ $TARGET_DEV =~ /[sh]d[a-z] ]]; then

Expand All @@ -31,15 +31,12 @@ fi
if [[ $TARGET_PARTITION == [0-9] ]]; then

# - Check for valid device ID
# Do not fail due to RPi has autodetection of hw_model
if ! HW_MODEL=$(</etc/.dietpi_hw_model_identifier); then

echo '[FAILED] Could not determine device ID from: /etc/.dietpi_hw_model_identifier'
exit 1

elif [[ $HW_MODEL =~ [^0-9] ]]; then

echo "[FAILED] Invalid hardware ID: $HW_MODEL"
exit 1
echo 'Assuming RPi'
HW_MODEL=0

fi

Expand Down

0 comments on commit 0816374

Please sign in to comment.