Created
January 22, 2021 06:37
-
-
Save MarkWalters-dev/7efbe0628ec3f55926b991f5c3a0e514 to your computer and use it in GitHub Desktop.
Setup repo that works with mkosi so you can install while offline
This file contains hidden or 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
#!/usr/bin/env bash | |
# Run this from inside a repo container | |
# After starting your repo with "machinectl start repo" you can create new containers offline using: | |
# mkosi -d centos_epel -r 8 --mirror=http://centos.repo.lan --hostname=cheese -o /var/lib/machines/cheese | |
# I have "10.1.1.2 centos.repo.lan" in /etc/hosts | |
# mkosi also needs to be manually patched to disable gpg checking. No flag for it as of today. | |
# Also no usable flags to disable all repos. --repositories='!*' does not work yet. | |
# So I have to make a lot of symlinks to prevent it from failing. | |
WEBROOT=/var/www/html | |
CENTOS=$WEBROOT/centos/8 | |
APPSTREAM=$CENTOS/AppStream | |
APPSTREAMOS=$APPSTREAM/x86_64/os | |
INSTALLROOT=$CENTOS/.root | |
EPEL=$WEBROOT/epel/8/Everything | |
dnf -y --releasever=8 --disablerepo=local install httpd createrepo yum-utils | |
yum-config-manager --enable powertools | |
yum-config-manager --enable epel | |
systemctl enable httpd | |
mkdir -p $APPSTREAMOS $INSTALLROOT $EPEL | |
dnf -y --releasever=8 --disablerepo=local --installroot=$INSTALLROOT --downloadonly --downloaddir $APPSTREAMOS install $(</root/pkglst) | |
createrepo $APPSTREAMOS | |
ln -s $APPSTREAM $CENTOS/BaseOS | |
ln -s $APPSTREAM $CENTOS/extras | |
ln -s $APPSTREAM $CENTOS/centosplus | |
ln -s $APPSTREAMOS $EPEL/x86_64 |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Run this from inside a repo container | |
# This will update your repo. Run it after updating /root/pkglst or when your repo is outdated. | |
CENTOS=/var/www/html/centos/8 | |
APPSTREAMOS=$CENTOS/AppStream/x86_64/os | |
INSTALLROOT=$CENTOS/.root | |
dnf -y --releasever=8 --disablerepo=local --installroot=$INSTALLROOT --downloadonly --downloaddir $APPSTREAMOS install $(</root/pkglst) | |
createrepo --update $APPSTREAMOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment