Skip to content

Commit

Permalink
v6.19.7
Browse files Browse the repository at this point in the history
- DietPi-Software | Netdata: Resolved an issue, where uninstalling netdata lead to a broken system. Thanks to @PDXUser for reporting this issue: https://github.com/Fourdee/DietPi/issues/2336
- DietPi-Software | Docker: Resolved an issue on RPi, where a faulty "docker-ce" version from repository prevents service start on Raspberry Pi. Thanks to @iAreSee and @garret for reporting this issue, finding and testing workarounds: https://github.com/Fourdee/DietPi/issues/2282
  • Loading branch information
MichaIng authored Dec 10, 2018
1 parent d58835c commit 06c1220
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 35 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v6.19.7
(10/12/18 Hotfix)

Bug Fixes:
- DietPi-Software | Netdata: Resolved an issue, where uninstalling netdata lead to a broken system. Thanks to @PDXUser for reporting this issue: https://github.com/Fourdee/DietPi/issues/2336
- DietPi-Software | Docker: Resolved an issue on RPi, where a faulty "docker-ce" version from repository prevents service start on Raspberry Pi. Thanks to @iaresee and @Garret for reporting this issue, finding and testing workarounds: https://github.com/Fourdee/DietPi/issues/2282

v6.19.6
(05/12/18 Hotfix)

Expand Down
51 changes: 31 additions & 20 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -6104,6 +6104,11 @@ If you want to update ${aSOFTWARE_WHIP_NAME[$software_id]}, please use it's inte

INSTALL_URL_ADDRESS='https://get.docker.com'

# Current workaround for faulty docker-ce repo version on RPi: https://github.com/Fourdee/DietPi/issues/2282
(( $G_HW_MODEL < 10 )) && echo 'Package: docker-ce
Pin: version 5:18.09.0~3-0~raspbian-stretch
Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix

G_CHECK_URL "$INSTALL_URL_ADDRESS"

# Offical Docker recommended install command
Expand Down Expand Up @@ -10353,12 +10358,13 @@ _EOF_
dps_index=$software_id Download_Install 'netdata.service' /etc/systemd/system/netdata.service

# - Create netdata user/group
getent passwd netdata > /dev/null || useradd -r netdata -c netdata -s /usr/sbin/nologin -d /
getent passwd netdata &> /dev/null || useradd -r netdata -s /usr/sbin/nologin -d /var/lib/netdata

for i in /var/cache/netdata /usr/share/netdata/web /etc/netdata /var/log/netdata /var/lib/netdata; do
for i in /var/cache/netdata /usr/share/netdata/web /etc/netdata /var/log/netdata /var/lib/netdata
do

chown -R netdata.netdata $i
chmod 0775 -R $i
chown -R netdata:netdata $i
chmod -R 0775 $i

done

Expand Down Expand Up @@ -13724,22 +13730,23 @@ _EOF_
#apt-mark auto zlib1g-dev &> /dev/null

#all
rm /etc/systemd/system/netdata.service
[[ -f /etc/systemd/system/netdata.service ]] && rm /etc/systemd/system/netdata.service

userdel -rf netdata
groupdel netdata
getent passwd netdata &> /dev/null && userdel netdata

#1.2.0+
G_AGP netdata

#1.0.0
rm /usr/sbin/netdata
[[ -f /usr/sbin/netdata ]] && rm /usr/sbin/netdata

rm -R /etc/netdata
rm -R /usr/share/netdata
rm -R /usr/libexec/netdata
rm -R /var/cache/netdata
rm -R /var/log/netdata
[[ -d /etc/netdata ]] && rm -R /etc/netdata
[[ -d /usr/lib/netdata ]] && rm -R /usr/lib/netdata
[[ -d /usr/share/netdata ]] && rm -R /usr/share/netdata
[[ -d /usr/libexec/netdata ]] && rm -R /usr/libexec/netdata
[[ -d /var/cache/netdata ]] && rm -R /var/cache/netdata
[[ -d /var/log/netdata ]] && rm -R /var/log/netdata
[[ -d /var/lib/netdata ]] && rm -R /var/lib/netdata

fi

Expand Down Expand Up @@ -14066,15 +14073,19 @@ _EOF_

Banner_Uninstalling

# remove docker and all its unused dependencies
G_AGP docker-ce docker-engine
# Remove docker, all its unused dependencies and custom repository
G_AGP docker-ce docker-ce-cli docker docker-engine
[[ -f /etc/apt/sources.list.d/docker.list ]] && rm /etc/apt/sources.list.d/docker.list

rm -R /lib/systemd/system/docker.service.d
# Remove service adjustments
[[ -d /lib/systemd/system/docker.service.d ]] && rm -R /lib/systemd/system/docker.service.d
# Delete data files - dietpi
[[ -d $G_FP_DIETPI_USERDATA/docker-data ]] && rm -R $G_FP_DIETPI_USERDATA/docker-data
# Remove default unused folder
[[ -d /var/lib/docker ]] && rm -R /var/lib/docker

# delete data files - dietpi
rm -r $G_FP_DIETPI_USERDATA/docker-data
# remove default unused folder
rm -r /var/lib/docker
# Faulty "docker-ce" package version fix; This can be removed after repo got an update: https://github.com/Fourdee/DietPi/issues/2282
[[ -f /etc/apt/preferences.d/dietpi-docker_fix ]] && rm /etc/apt/preferences.d/dietpi-docker_fix

fi

Expand Down
18 changes: 18 additions & 0 deletions dietpi/patch_file
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,24 @@ You will not face any practical differences, since both services start the same
# Xorg: XU4 conf
(( $G_DIETPI_INSTALL_STAGE == 1 )) && /DietPi/dietpi/dietpi-software reinstall 48 113 160 163 6
#-------------------------------------------------------------------------------
#Docker fix on RPi due to faulty current "docker-ce" repo version: https://github.com/Fourdee/DietPi/issues/2282
local dpkg_out=''
if (( G_HW_MODEL < 10 )) && dpkg_out="$(dpkg-query -s 'docker-ce' 2>&1)"; then

echo 'Package: docker-ce
Pin: version 5:18.09.0~3-0~raspbian-stretch
Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix

if grep -q '5:18.09.0~3-0~raspbian-stretch' <<< "$dpkg_out"; then

G_DIETPI-NOTIFY 2 'Docker: Downgrading your "docker-ce" package to the last working version'
G_AGI docker-ce=18.06.1~ce~3-0~raspbian
G_AGA

fi

fi
#-------------------------------------------------------------------------------

fi

Expand Down
80 changes: 66 additions & 14 deletions dietpi/pre-patch_file
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
while (( $EXIT_CODE == 0 ))
do

echo -e "\n\e[1m $G_PROGRAM_NAME\e[0m
echo -e "\n \e[1m$G_PROGRAM_NAME\e[0m
\e[90m─────────────────────────────────────────────────────\e[0m
[ INFO ] Applying critical pre-patches\n"
[ \e[1mINFO\e[0m ] Applying critical pre-patches\n"

#-------------------------------------------------------------------------------
# Pre-patch 1: RAMlog 0 free space check due to issues with failing DietPi cron jobs in v6.11
Expand All @@ -62,38 +62,90 @@

echo -e '[ \e[1mINFO\e[0m ] Pre-patch 2 | Nginx: Hotfix to apply new naming scheme for /etc/nginx/sites-dietpi/*.(config => conf)'
sed -i 's|include /etc/nginx/sites-dietpi/\*\.config;|include /etc/nginx/sites-dietpi/\*\.conf;|g' /etc/nginx/sites-available/default
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 2 | An error occured while applying the fix to: /etc/nginx/sites-available/default
- Please apply it manually. Replace:
include /etc/nginx/sites-dietpi/*.config; with
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 2 | An error occurred while applying the fix to: /etc/nginx/sites-available/default
- Please apply it manually. Replace the line:
include /etc/nginx/sites-dietpi/*.config; with
include /etc/nginx/sites-dietpi/*.conf;'
/DietPi/dietpi/dietpi-services start

fi

echo -e '[ \e[1mINFO\e[0m ] Pre-patch 3 | DietPi-Software: Resolving "systemctl force-reload" error in case of inactive services'
sed -Ei 's/G_RUN_CMD systemctl force-reload (lighttpd|nginx|apache2)/G_RUN_CMD systemctl restart \1/g' /DietPi/dietpi/dietpi-software
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 3 | An error occured while applying the fix to: /DietPi/dietpi/dietpi-software
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 3 | An error occurred while applying the fix to: /DietPi/dietpi/dietpi-software
- Please apply it manually. Replace the 3 lines:
G_RUN_CMD systemctl force-reload lighttpd|nginx|apache2 with
G_RUN_CMD systemctl restart lighttpd|nginx|apache2 respectively'

sed -i '/G_DIETPI_VERSION_RC=/c\G_DIETPI_VERSION_RC=6' /DietPi/dietpi/.version

fi
#-------------------------------------------------------------------------------
# Pre-patch 4: Prevent netdata uninstall from breaking the system: https://github.com/Fourdee/DietPi/issues/2336
# Pre-patch 5: Prevent APT upgrade to faulty docker-ce version on RPi: https://github.com/Fourdee/DietPi/issues/2282
if [[ $G_DIETPI_VERSION_SUB.$(sed -n 4p /DietPi/dietpi/.version) == '19.G_DIETPI_VERSION_RC=6' ]]; then

echo -e '[ \e[1mINFO\e[0m ] Pre-patch 4 | Netdata: Fixing a critical issue, where uninstalling netdata would break the system'
sed -i 's/userdel -rf netdata/userdel netdata/g' /DietPi/dietpi/dietpi-software
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 4 | An error occurred while applying the fix to: /DietPi/dietpi/dietpi-software
- Please apply it manually. Replace the line:
userdel -rf netdata with
userdel netdata'

if (( $(sed -n 1p /DietPi/dietpi/.hw_model) < 10 )); then

echo -e '[ \e[1mINFO\e[0m ] Pre-patch 5 | Docker: Prevent install of a faulty "docker-ce" version in their APT repository'

if ! grep -q '/etc/apt/preferences.d/dietpi-docker_fix' /DietPi/dietpi/dietpi-software; then

sed -i "\|INSTALL_URL_ADDRESS='https://get.docker.com'|a\echo 'Package: docker-ce\nPin: version 5:18.09.0~3-0~raspbian-stretch\nPin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix" /DietPi/dietpi/dietpi-software
(( $? )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 5 | An error occurred while applying the fix to: /DietPi/dietpi/dietpi-software
- Please apply it manually. Add the following lines after INSTALL_URL_ADDRESS='\''https://get.docker.com'\'':
echo '\''Package: docker-ce
Pin: version 5:18.09.0~3-0~raspbian-stretch
Pin-Priority: -1'\'' > /etc/apt/preferences.d/dietpi-docker_fix'

fi

if dpkg_out="$(dpkg-query -s 'docker-ce' 2>&1)"; then

echo 'Package: docker-ce
Pin: version 5:18.09.0~3-0~raspbian-stretch
Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix

if grep -q '5:18.09.0~3-0~raspbian-stretch' <<< "$dpkg_out"; then

echo -e '[ \e[1mINFO\e[0m ] Pre-patch 5 | Docker: Downgrading your "docker-ce" package to the last working version'
apt-get install -y -qq --allow-downgrades --allow-change-held-packages --allow-unauthenticated docker-ce=18.06.1~ce~3-0~raspbian || EXIT_CODE=5
apt-get autoremove --purge -y || EXIT_CODE=5
(( $EXIT_CODE == 5 )) && echo -e '[\e[31mFAILED\e[0m] Pre-patch 5 | An error has occurred while attempting to downgrade your docker-ce version.
- Please try to manually downgrade via:
G_AGI docker-ce=18.06.1~ce~3-0~raspbian'

fi

fi

fi

sed -i '/G_DIETPI_VERSION_RC=/c\G_DIETPI_VERSION_RC=7' /DietPi/dietpi/.version

# Quit update after applying hotfix pre-patches 2-4, which will be replaced by regular code and patch_file update with v6.20
echo 0 > /DietPi/dietpi/.update_stage
rm /DietPi/dietpi/.update_available
sed -i '/G_DIETPI_VERSION_RC=/c\G_DIETPI_VERSION_RC=6' /DietPi/dietpi/.version
echo -e '\n[ \e[1mINFO\e[0m ] DietPi-Update will now exit. No reboot is required, no further update steps are done.
/DietPi/dietpi/dietpi-services start
echo -e '\n[ \e[32mOK\e[0m ] DietPi-Update will now exit. No reboot is required, no further update steps are done.
- To apply the new version string to your terminal session, please manually run:
source /DietPi/dietpi/func/dietpi-globals\n'
kill $PPID
exit

fi

echo -e "\e[1m $G_PROGRAM_NAME\e[0m
\e[90m─────────────────────────────────────────────────────\e[0m
[ INFO ] Completed pre-patches with exit code: $EXIT_CODE\n"

#-------------------------------------------------------------------------------
# Finished
echo -e " \e[1m$G_PROGRAM_NAME\e[0m
\e[90m─────────────────────────────────────────────────────\e[0m
[ \e[1mINFO\e[0m ] Completed pre-patches with exit code: \e[33m$EXIT_CODE\e[0m\n"

break
#-------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion dietpi/server_version-6
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
6
19
6
7

0 comments on commit 06c1220

Please sign in to comment.