Skip to content

Commit

Permalink
add script to download kernel packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsander-souza committed May 12, 2022
1 parent f142dc1 commit 9f207e4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ubuntu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ custom-ubuntu-lvm.dd.gz: clean seeds-lvm.iso OVMF_VARS.fd
clean:
sudo ${RM} -rf output-qemu custom-ubuntu*.gz

CUSTOM_PKGS:=${wildcard packages/*.deb}

packages/custom-packages.tar.gz: ${CUSTOM_PKGS}
tar czf $@ -C packages ${notdir $^}

.INTERMEDIATE: OVMF_VARS.fd
27 changes: 27 additions & 0 deletions ubuntu/packages/get-kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
#
# get-kernel - Downloads Ubuntu kernel packages
#
# Author: Alexsander de Souza <[email protected]>
#
# Copyright (C) 2022 Canonical
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
export LANG=C

KERNEL=${KERNEL:-linux-image-generic}

PKGS=$(apt-cache depends "${KERNEL}" | grep " Depends:" | sed 's/ Depends: //')

apt-get download "${KERNEL}" ${PKGS}
3 changes: 2 additions & 1 deletion ubuntu/scripts/install-custom-packages
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ dpkg -l 'linux-image-*' 'linux-headers-*' | awk '/^ii/{print $2}' | xargs apt-ge

echo "install new kernel"
tar xzf "${PKG_TGZ}" -C "${WORKDIR}"
apt install -y --no-install-recommends "${WORKDIR}"/linux-*.deb
apt install -y --no-install-recommends "${WORKDIR}"/*.deb
apt install --fix-broken

echo "purge unused packages"
apt autoremove -y

0 comments on commit 9f207e4

Please sign in to comment.