Commit 1059fe0a authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Sources install optimisation

parent 856218e2
...@@ -380,6 +380,8 @@ function reload_bsp(){ ...@@ -380,6 +380,8 @@ function reload_bsp(){
# install packages # install packages
echo $PACKAGE_LIST >> /var/log/upgrade.log echo $PACKAGE_LIST >> /var/log/upgrade.log
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE_LIST armbian-config debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends --reinstall -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE_LIST armbian-config
# clean apt cache
apt clean
if [[ $? = 1 ]]; then if [[ $? = 1 ]]; then
echo "Something went wrong ... check logs."; exit; echo "Something went wrong ... check logs."; exit;
else else
...@@ -457,6 +459,8 @@ function other_kernel_version () ...@@ -457,6 +459,8 @@ function other_kernel_version ()
find "/boot/" -name "vmlinuz*" -type f -delete find "/boot/" -name "vmlinuz*" -type f -delete
find "/boot/" -name "*nitrd*" -type f -delete find "/boot/" -name "*nitrd*" -type f -delete
debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install $PACKAGE_LIST
# clean apt cache
apt clean
if [[ $? = 0 ]]; then reboot; fi if [[ $? = 0 ]]; then reboot; fi
else else
dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48 dialog --backtitle "$BACKTITLE" --title "Warning" --msgbox "\nTest install failed. Can't change firmware \n\nCheck /tmp/switch_kernel.log" 9 48
...@@ -688,7 +692,7 @@ function configure_desktop () ...@@ -688,7 +692,7 @@ function configure_desktop ()
[[ $? -eq 130 ]] && dpkg --configure -a [[ $? -eq 130 ]] && dpkg --configure -a
# clean apt cache # clean apt cache
apt-get clean apt clean
# add user to groups # add user to groups
for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do
......
...@@ -169,6 +169,7 @@ function jobs () ...@@ -169,6 +169,7 @@ function jobs ()
debconf-apt-progress -- apt-get -y install ${INSTALL_PKG} debconf-apt-progress -- apt-get -y install ${INSTALL_PKG}
fi fi
# cleanup # cleanup
apt clean
debconf-apt-progress -- apt -y autoremove debconf-apt-progress -- apt -y autoremove
fi fi
;; ;;
...@@ -182,10 +183,10 @@ function jobs () ...@@ -182,10 +183,10 @@ function jobs ()
"Source" ) "Source" )
if ! is_package_manager_running; then if ! is_package_manager_running; then
PACKAGE=$(echo "$SOURCE_PKG" | sed "s/-next//" | sed "s/-dev//" | sed "s/-default//") PACKAGE=$(echo "$SOURCE_PKG" | sed "s/-next//" | sed "s/-dev//" | sed "s/-default//")
if [[ -n $(dpkg -l | grep $SOURCE_PKG) ]]; then if ls /usr/src/linux-source* 1> /dev/null 2>&1; then
debconf-apt-progress -- apt-get -y purge linux-source* debconf-apt-progress -- apt-get -y purge linux-source*
# cleanup debconf-apt-progress -- apt -y autoremove
debconf-apt-progress -- apt -y autoremove apt clean
rm -r /usr/src/linux-source* rm -r /usr/src/linux-source*
else else
debconf-apt-progress -- apt-get -y install ${SOURCE_PKG} debconf-apt-progress -- apt-get -y install ${SOURCE_PKG}
...@@ -193,6 +194,9 @@ function jobs () ...@@ -193,6 +194,9 @@ function jobs ()
(pv -n /usr/src/$PACKAGE".tar.xz" | xz -d -T0 - | tar xf - -C /usr/src/$PACKAGE ) 2>&1 | dialog --colors --backtitle "$BACKTITLE" --title " Please wait! " --gauge "\nDecompressing kernel sources to /usr/src/$PACKAGE" 8 80 (pv -n /usr/src/$PACKAGE".tar.xz" | xz -d -T0 - | tar xf - -C /usr/src/$PACKAGE ) 2>&1 | dialog --colors --backtitle "$BACKTITLE" --title " Please wait! " --gauge "\nDecompressing kernel sources to /usr/src/$PACKAGE" 8 80
xz -d /usr/src/*config.xz --stdout > /usr/src/$PACKAGE/.config xz -d /usr/src/*config.xz --stdout > /usr/src/$PACKAGE/.config
rm /usr/src/$PACKAGE".tar.xz" /usr/src/*config.xz rm /usr/src/$PACKAGE".tar.xz" /usr/src/*config.xz
apt clean
debconf-apt-progress -- apt-get -y purge linux-source*
debconf-apt-progress -- apt -y autoremove
dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " Kernel source " --clear --msgbox "\nYou will find pre-configured kernel sources in /usr/src/$PACKAGE" 7 72 dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " Kernel source " --clear --msgbox "\nYou will find pre-configured kernel sources in /usr/src/$PACKAGE" 7 72
fi fi
fi fi
......
...@@ -356,7 +356,7 @@ while true; do ...@@ -356,7 +356,7 @@ while true; do
SOURCE_PKG=$(apt-cache --names-only search ^linux-source-* | awk '{ print $1 }' | grep ${BRANCH}-${LINUXFAMILY} | tail -1) SOURCE_PKG=$(apt-cache --names-only search ^linux-source-* | awk '{ print $1 }' | grep ${BRANCH}-${LINUXFAMILY} | tail -1)
if [[ -n $SOURCE_PKG ]]; then if [[ -n $SOURCE_PKG ]]; then
if [[ -n $(dpkg -l | grep $SOURCE_PKG) ]]; then LIST+=( "Source" "Remove kernel source" ); else \ if ls /usr/src/linux-source* 1> /dev/null 2>&1; then LIST+=( "Source" "Remove kernel source" ); else \
LIST+=( "Source" "Install kernel source" ); fi LIST+=( "Source" "Install kernel source" ); fi
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment