-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working docker image for extracting ubuntu iso kernel
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM debian:stable-slim | ||
RUN apt update \ | ||
&& apt install -y \ | ||
p7zip-full \ | ||
rsync \ | ||
&& apt clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
VOLUME /tftp | ||
COPY scripts /scripts | ||
|
||
ENTRYPOINT ["bash", "/scripts/ubuntu.sh"] |
2 changes: 2 additions & 0 deletions
2
docker/estenrye/ubuntu-pxe-image-mirror/scripts/date-script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
echo "Current date and time is " "$(date +%D-%H:%M)" |
30 changes: 30 additions & 0 deletions
30
docker/estenrye/ubuntu-pxe-image-mirror/scripts/extract.ubuntu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
fatal() { | ||
echo "$1" | ||
exit 1 | ||
} | ||
|
||
warn() { | ||
echo "$1" | ||
} | ||
|
||
LIVE_KERNEL_ROOT='/tftp/live/ubuntu/live-server-amd64' | ||
IMAGE_ROOT='/tftp/images/ubuntu' | ||
VERSION_PATTERN='[0-9][0-9]\.[0-9][0-9]$' | ||
ISO_PATTERN='live-server-amd64\.iso$' | ||
|
||
for ISOFILE in `ls ${IMAGE_ROOT} | grep ${VERSION_PATTERN} | xargs -I% find ${IMAGE_ROOT}/%/ -print | grep ${ISO_PATTERN}` | ||
do | ||
VERSION=`basename $(dirname $ISOFILE)` | ||
|
||
echo "Creating directory ${LIVE_KERNEL_ROOT}/${VERSION}" | ||
mkdir -p "${LIVE_KERNEL_ROOT}/${VERSION}" | ||
rm -f ${LIVE_KERNEL_ROOT}/${VERSION}/ubuntu-live-server-amd64.iso | ||
|
||
echo "Linking ${ISOFILE} to ${LIVE_KERNEL_ROOT}/${VERSION}/ubuntu-live-server-amd64.iso" | ||
ln -s ${ISOFILE} ${LIVE_KERNEL_ROOT}/${VERSION}/ubuntu-live-server-amd64.iso | ||
|
||
echo "Copying ${ISO_MNT_ROOT}/${VERSION}/casper to directory ${LIVE_KERNEL_ROOT}/${VERSION}" | ||
7z e -tiso -o/${LIVE_KERNEL_ROOT}/${VERSION} -i\!casper/initrd -i\!casper/vmlinuz ${ISOFILE} | ||
done |
30 changes: 30 additions & 0 deletions
30
docker/estenrye/ubuntu-pxe-image-mirror/scripts/rsync.ubuntu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
fatal() { | ||
echo "$1" | ||
exit 1 | ||
} | ||
|
||
warn() { | ||
echo "$1" | ||
} | ||
|
||
# Find a source mirror near you which supports rsync on | ||
# https://launchpad.net/ubuntu/+cdmirrors | ||
# rsync://<iso-country-code>.rsync.releases.ubuntu.com/releases should always work | ||
RSYNCSOURCE=rsync://mirror.math.princeton.edu/pub/ubuntu-iso/ | ||
|
||
# Define where you want the mirror-data to be on your mirror | ||
BASEDIR=/tftp/images/ubuntu/ | ||
|
||
if [ ! -d ${BASEDIR} ]; then | ||
warn "${BASEDIR} does not exist yet, trying to create it..." | ||
mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed." | ||
mkdir -p ${BASEDIR}/.trace || fatal "Creation of ${BASEDIR}/.trace failed." | ||
fi | ||
|
||
rsync --verbose --recursive --times --links --safe-links --hard-links \ | ||
--stats --delete-after \ | ||
${RSYNCSOURCE} ${BASEDIR} || fatal "Failed to rsync from ${RSYNCSOURCE}." | ||
|
||
date -u > ${BASEDIR}/.trace/$(hostname -f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
fatal() { | ||
echo "$1" | ||
exit 1 | ||
} | ||
|
||
warn() { | ||
echo "$1" | ||
} | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
${SCRIPT_DIR}/date-script.sh || fatal "Failed to run date-script.sh." | ||
${SCRIPT_DIR}/rsync.ubuntu.sh || fatal "Failed to rsync from ${RSYNCSOURCE}." | ||
${SCRIPT_DIR}/extract.ubuntu.sh || fatal "Failed to extract from ${RSYNCSOURCE}." |