Let's redo ubuntu

This commit is contained in:
ferrreo 2023-09-06 14:05:12 +01:00
parent 406b56e3eb
commit 7dc96e7c63
7 changed files with 24 additions and 10 deletions

BIN
ppp

Binary file not shown.

View File

@ -32,7 +32,6 @@ func main() {
Source: os.Args[1], Source: os.Args[1],
Target: os.Args[2], Target: os.Args[2],
Download: false, Download: false,
Is32bit: false,
} }
if len(os.Args) > 3 { if len(os.Args) > 3 {
@ -41,14 +40,10 @@ func main() {
config.Output = os.Args[4] config.Output = os.Args[4]
} }
if strings.Contains(config.Source, "i386") {
config.Is32bit = true
}
basePackages := processFile(config.Source) basePackages := processFile(config.Source)
targetPackages := processFile(config.Target) targetPackages := processFile(config.Target)
changed := compare(basePackages, targetPackages, config.Download, config.Is32bit) changed := compare(basePackages, targetPackages, config.Download)
if config.Download { if config.Download {
download(changed, config.DlUrl, config.Output) download(changed, config.DlUrl, config.Output)
} }
@ -123,17 +118,17 @@ func processFile(url string) map[string]packageInfo {
return packages return packages
} }
func compare(basePackages map[string]packageInfo, targetPackages map[string]packageInfo, download bool, is32bit bool) map[string]packageInfo { func compare(basePackages map[string]packageInfo, targetPackages map[string]packageInfo, download bool) map[string]packageInfo {
output := make(map[string]packageInfo) output := make(map[string]packageInfo)
for pack, info := range targetPackages { for pack, info := range targetPackages {
if baseVersion, ok := basePackages[pack]; ok { if baseVersion, ok := basePackages[pack]; ok {
if version.Compare(info.Version, baseVersion.Version) > 0 && (!is32bit || !strings.HasSuffix(info.FilePath, "all.deb")) { if version.Compare(info.Version, baseVersion.Version) > 0 {
output[pack] = info output[pack] = info
if !download { if !download {
os.Stdout.WriteString(pack) os.Stdout.WriteString(pack)
} }
} }
} else if !is32bit || !strings.HasSuffix(info.FilePath, "all.deb") { } else {
output[pack] = info output[pack] = info
if !download { if !download {
os.Stdout.WriteString(pack) os.Stdout.WriteString(pack)
@ -298,7 +293,6 @@ type config struct {
Download bool Download bool
DlUrl string DlUrl string
Output string Output string
Is32bit bool
} }
type packageInfo struct { type packageInfo struct {

View File

@ -60,6 +60,10 @@ else
sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions
fi fi
apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar" ../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar"

View File

@ -60,6 +60,10 @@ else
sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions
fi fi
apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar" ../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar"

View File

@ -60,6 +60,10 @@ else
sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions
fi fi
apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar" ../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar"

View File

@ -60,6 +60,10 @@ else
sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions
fi fi
apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar" ../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar"

View File

@ -60,6 +60,10 @@ else
sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions sed -i "s#Components:#Components: ubuntu#" ./output/repo/conf/distributions
fi fi
apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar" ../ppp repoadd ./output/ "--keepunusednewfiles --keepunreferencedfiles -C ubuntu -V --ignore=missingfield --basedir ./output/repo/ includedeb lunar"