Commit 253d2cf4 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Fix kernel source install via command

parent 7d7ebb11
......@@ -76,8 +76,10 @@ if [[ $1 == "--help" ]]; then
echo "Update, upgrade and reboot: ${BASH_SOURCE[0]} main=System selection=Firmware"
echo "Change to ZSH: ${BASH_SOURCE[0]} main=System selection=ZSH"
echo "Change to BASH: ${BASH_SOURCE[0]} main=System selection=BASH"
echo "Install headers: ${BASH_SOURCE[0]} main=Software selection=Headers"
echo "Install sources: ${BASH_SOURCE[0]} main=Software selection=Sources"
echo "Install headers: ${BASH_SOURCE[0]} main=Software selection=Headers_install"
echo "Remove headers: ${BASH_SOURCE[0]} main=Software selection=Headers_remove"
echo "Install kernel source: ${BASH_SOURCE[0]} main=Software selection=Source_install"
echo "Remove kernel source: ${BASH_SOURCE[0]} main=Software selection=Source_remove"
echo "Install Avahi mDNS/DNS-SD daemon: ${BASH_SOURCE[0]} main=Software selection=Avahi"
exit
fi
......
......@@ -153,16 +153,24 @@ unset selection
#
# Install kernel headers
#
"Headers" )
"Headers_install" )
if ! is_package_manager_running; then
TARGET_BRANCH=$BRANCH
exceptions "$BRANCH"
REMOVE_PKG="linux-headers-*"
if [[ -f /etc/armbian-release ]]; then
INSTALL_PKG="linux-headers${TARGET_BRANCH}-${TARGET_FAMILY}";
INSTALL_PKG="linux-headers-${BRANCH}-${LINUXFAMILY}";
else
INSTALL_PKG="linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')";
fi
debconf-apt-progress -- apt-get -y install ${INSTALL_PKG}
fi
;;
#
# Remove kernel headers
#
"Headers_remove" )
if ! is_package_manager_running; then
REMOVE_PKG="linux-headers-*"
if [[ -n $(dpkg -l | grep linux-headers) ]]; then
debconf-apt-progress -- apt-get -y purge ${REMOVE_PKG}
rm -rf /usr/src/linux-headers*
......@@ -176,22 +184,14 @@ unset selection
;;
#
# Install kernel source
#
"Source" )
"Source_install" )
if ! is_package_manager_running; then
PACKAGE=$(echo "$SOURCE_PKG" | sed "s/-current//" | sed "s/-dev//" | sed "s/-legacy//")
if [[ -n $PACKAGE ]]; 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 -y autoremove
apt clean
rm -r /usr/src/linux-source*
else
debconf-apt-progress -- apt-get -y install ${SOURCE_PKG}
mkdir -p /usr/src/$PACKAGE
(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
......@@ -203,13 +203,32 @@ unset selection
if [[ -z $scripted ]]; then
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
;;
#
# Install kernel source
#
"Source_remove" )
if ! is_package_manager_running; then
PACKAGE=$(echo "$SOURCE_PKG" | sed "s/-current//" | sed "s/-dev//" | sed "s/-legacy//")
if [[ -n $PACKAGE ]]; 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 -y autoremove
apt clean
rm -r /usr/src/linux-source*
fi
fi
fi
;;
# Toggle mini and full firmware
#
......
......@@ -361,13 +361,13 @@ while true; do
LIST+=( "Benchmarking" "sbc-bench board benchmarking" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Diagnostics" "Send diagnostics" )
if [[ -n $(dpkg -l | grep linux-headers) ]]; then LIST+=( "Headers" "Remove kernel headers" ); else \
LIST+=( "Headers" "Install kernel headers" ); fi
if [[ -n $(dpkg -l | grep linux-headers) ]]; then LIST+=( "Headers_remove" "kernel headers" ); else \
LIST+=( "Headers_install" "kernel headers" ); fi
SOURCE_PKG=$(apt-cache --names-only search ^linux-source-* | awk '{ print $1 }' | grep ${BRANCH}-${LINUXFAMILY} | tail -1)
if [[ -n $SOURCE_PKG ]]; then
if ls /usr/src/linux-source* 1> /dev/null 2>&1; then LIST+=( "Source" "Remove kernel source" ); else \
LIST+=( "Source" "Install kernel source" ); fi
if ls /usr/src/linux-source* 1> /dev/null 2>&1; then LIST+=( "Source_remove" "kernel source" ); else \
LIST+=( "Source_install" "kernel source" ); fi
fi
if [[ -f /etc/armbian.txt ]]; then
......
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