Skip to content

Instantly share code, notes, and snippets.

@aarroyoc
Last active October 11, 2024 16:04
Show Gist options
  • Save aarroyoc/1a96b2f8b01fcf34221a to your computer and use it in GitHub Desktop.
Save aarroyoc/1a96b2f8b01fcf34221a to your computer and use it in GitHub Desktop.
Debian/Ubuntu repo using apt-ftparchive
Dir {
ArchiveDir "./debian";
CacheDir "./cache";
};
Default {
Packages::Compress ". gzip bzip2";
Sources::Compress ". gzip bzip2";
Contents::Compress ". gzip bzip2";
};
TreeDefault {
BinCacheDB "packages-$(SECTION)-$(ARCH).db";
Directory "pool/$(SECTION)";
Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
SrcDirectory "pool/$(SECTION)";
Sources "$(DIST)/$(SECTION)/source/Sources";
Contents "$(DIST)/Contents-$(ARCH)";
};
Tree "dists/trusty" {
Sections "main";
Architectures "i386 amd64 all source";
}
Tree "dists/precise" {
Sections "main";
Architectures "i386 amd64 all source";
}
Tree "dists/stable" {
Sections "main";
Architectures "i386 amd64 all source";
}
Tree "dists/testing" {
Sections "main";
Architectures "i386 amd64 all source";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Debian/Ubuntu repository</title>
</head>
<body>
<h1>Debian/Ubuntu repository</h1>
<p>Add the following lines to your sources.list file</p>
<code>
deb http://HOSTNAME/debian trusty main
<br>
deb-src http://HOSTNAME/debian trusty main
</code>
Where trusty can be:
<ul>
<li>trusty</li>
<li>precise</li>
<li>stable</li>
<li>testing</li>
</ul>
You might also want the security key. Get it:
<code>
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys PUBKEYS
</code>
</body>
</html>
APT::FTPArchive::Release::Codename "precise";
APT::FTPArchive::Release::Origin "Your hosted repo";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "Packages hosted by you";
APT::FTPArchive::Release::Architectures "i386 amd64 all source";
APT::FTPArchive::Release::Suite "precise";
APT::FTPArchive::Release::Codename "stable";
APT::FTPArchive::Release::Origin "Your hosted repo";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "Packages hosted by you";
APT::FTPArchive::Release::Architectures "i386 amd64 all source";
APT::FTPArchive::Release::Suite "stable";
APT::FTPArchive::Release::Codename "testing";
APT::FTPArchive::Release::Origin "Your hosted repo";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "Packages hosted by you";
APT::FTPArchive::Release::Architectures "i386 amd64 all source";
APT::FTPArchive::Release::Suite "testing";
APT::FTPArchive::Release::Codename "trusty";
APT::FTPArchive::Release::Origin "Your hosted repo";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "Packages hosted by you";
APT::FTPArchive::Release::Architectures "i386 amd64 all source";
APT::FTPArchive::Release::Suite "trusty";
#!/bin/bash
# Put your packages and sources *.deb, *.orig.tar.gz, *.dsc, *.changes to debian/pool/main
#This should be on the root of Apache or Nginx
mkdir -p debian/dists/{precise,trusty,stable,testing}/main/{binary-all,binary-i386,binary-amd64,source}
mkdir -p debian/pool/main
mkdir -p cache
apt-ftparchive generate apt-ftparchive.conf
apt-ftparchive -c precise.conf release debian/dists/precise > debian/dists/precise/Release
apt-ftparchive -c trusty.conf release debian/dists/trusty > debian/dists/trusty/Release
apt-ftparchive -c stable.conf release debian/dists/stable > debian/dists/stable/Release
apt-ftparchive -c testing.conf release debian/dists/testing > debian/dists/testing/Release
gpg --output debian/dists/trusty/Release.gpg -ba debian/dists/trusty/Release
gpg --output debian/dists/precise/Release.gpg -ba debian/dists/precise/Release
gpg --output debian/dists/stable/Release.gpg -ba debian/dists/stable/Release
gpg --output debian/dists/testing/Release.gpg -ba debian/dists/testing/Release
@djha-skin
Copy link

Where has this been all my life

@matthijs-oosterhoff
Copy link

This is very helpful, thanks a lot!

@vidstige
Copy link

where do I put my deb files though? 🤔

@vidstige
Copy link

alright, they go into debian/pool/main but must end in e.g. _amd64.deb. Files just named mypackage.deb will be skipped.

@yjiawqgj
Copy link

MobaXterm1_CHS1_MjvtxfMB4j
My synology does not support apt, I run this script on my synology, it shows the following error how can I do it?

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