Update main.sh

This commit is contained in:
ferreo 2024-08-04 17:35:29 +02:00
parent 8059d3a323
commit 3a6c1c0289

23
main.sh
View File

@ -13,26 +13,9 @@ git clone https://github.com/pop-os/cosmic-settings.git
cd cosmic-settings
# Get build deps
awk '
BEGIN { RS=""; ORS="\n\n"; FS="\n"; OFS="\n" }
{
if ($1 ~ /^Build-Depends:/) {
split($1, parts, ":")
deps = parts[2]
gsub(/^[[:space:]]+|[[:space:]]+$/, "", deps)
split(deps, items, ",")
new_deps = ""
for (i in items) {
gsub(/^[[:space:]]+|[[:space:]]+$/, "", items[i])
if (items[i] != "cargo" && items[i] != "rustc" && items[i] != "rust-all") {
if (new_deps != "") new_deps = new_deps ", "
new_deps = new_deps items[i]
}
}
$1 = "Build-Depends:\n " new_deps
}
print
}' ./debian/control > ./debian/control.tmp && mv ./debian/control.tmp ./debian/control
perl -0777 -pe '
s/^(Build-Depends:\s*\n)(.+?)(\n\S)/$1 . join(",\n", grep { !/^\s*(cargo|rustc|rust-all)\s*$/ } split /,\s*\n/, $2) . $3/ems;
' ./debian/control > ./debian/control.tmp && mv ./debian/control.tmp ./debian/control
apt-get build-dep ./ -y
apt-get install curl -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/root/.cargo sh -s -- -y