Skip to content

Instantly share code, notes, and snippets.

@linuxluser
Last active January 12, 2024 04:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linuxluser/3af5fd16dde41b82972a to your computer and use it in GitHub Desktop.
Save linuxluser/3af5fd16dde41b82972a to your computer and use it in GitHub Desktop.
#!/bin/sh
#
## Making a local repository
#
PKGS_DIR=/home/linuxluser/pkgs/
BASE_DIR=/tmp/repo
SUITE=jessie
COMPONENT=main
mkdir $BASE_DIR
cd $BASE_DIR
mkdir pool
cp $PKGS_DIR/*.deb ./pool/
mkdir -p ./dists/$SUITE/$COMPONENT/binary-amd64
dpkg-scanpackages pool /dev/null | gzip -9c > dists/$SUITE/$COMPONENT/binary-amd64/Packages.gz
# prepend line to sources.list so local repo takes precedence against foreign packages of the same name+version
sed -i "1i deb file://$BASE_DIR $SUITE $COMPONENT" /etc/apt/sources.list
apt-get update
@Luke-SF
Copy link

Luke-SF commented Jan 11, 2024

Doesn't work because as a copy of the USB linux install drive, pkgs/ will not have *deb files on it.

@linuxluser
Copy link
Author

Doesn't work because as a copy of the USB linux install drive, pkgs/ will not have *deb files on it.

This gist was intended to be used on a live system. If you want the resulting local repo to on the installer image and available during an install, you'll have to do more than what's here.

Probably a better idea than this gist is to use the aptly tool, which is a lot better at making and managing Debian repos. Create a repo using aptly on a separate server and then use a preseed file in your install which sets up this server as another repository. At that point, you can also add custom packages to get install using the preseed, etc. It's a lot easier to do this than to manipulate the installer image by adding files to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment