Let's redo ubuntu
This commit is contained in:
parent
406b56e3eb
commit
7dc96e7c63
14
src/main.go
14
src/main.go
@ -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 {
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user