Skip to content

Instantly share code, notes, and snippets.

@MarkWalters-dev
Created January 22, 2021 06:37
Show Gist options
  • Select an option

  • Save MarkWalters-dev/7efbe0628ec3f55926b991f5c3a0e514 to your computer and use it in GitHub Desktop.

Select an option

Save MarkWalters-dev/7efbe0628ec3f55926b991f5c3a0e514 to your computer and use it in GitHub Desktop.

Revisions

  1. MarkWalters-dev created this gist Jan 22, 2021.
    30 changes: 30 additions & 0 deletions reposetup
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    #!/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
    10 changes: 10 additions & 0 deletions repoupdate
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/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