Skip to content

Commit

Permalink
ympstrap add gpg key
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Apr 5, 2024
1 parent 03fe8a8 commit bf2afc5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions scripts/ympstrap
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ function pkginst(){
rm -rf "$output"/tmp
}
# Stage 1 download repo
mkdir "$output"/var/lib/ymp/{index,packages,sources.list.d}/ -p
mkdir "$output"/var/lib/ymp/{index,packages,sources.list.d,gpg}/ -p
echo "$repo" > "$output"/var/lib/ymp/sources.list.d/main
wget -O "$output"/var/lib/ymp/gpg/main "${repo/\$uri/ymp-index.yaml.asc}"
wget -O "$output"/tmp/main.asc "${repo/\$uri/ymp-index.yaml.asc}"
gpg --dearmor "$output"/tmp/main.asc
mv "$output"/tmp/main.asc.gpg "$output"/var/lib/ymp/gpg/main.gpg
rm "$output"/tmp/main.asc
wget -O - ${repo/\$uri/ymp-index.yaml} | grep "uri: " > "$output"/var/lib/ymp/index/main
# Stage 2 install base
fetch_pkg ${basepkgs[@]}
Expand Down
5 changes: 4 additions & 1 deletion src/operations/package-manager/bootstrap.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ private static int bootstrap_main (string[] args) {
bool sysconf = get_bool ("no-sysconf");
set_bool ("no-sysconf", true);
copy_file ("/etc/resolv.conf", rootfs + "/etc/resolv.conf");
writefile (rootfs + "/" + STORAGEDIR + "/sources.list", repo + "\n");
writefile (rootfs + "/" + STORAGEDIR + "/sources.list.d/main", repo + "\n");
writefile (rootfs + "/" + STORAGEDIR + "/restricted.list", "/data/user\n");
fetch(repo.replace("$uri", "ymp-index.yaml.asc"), rootfs + "/tmp/main.asc");
add_gpg_key(rootfs + "/tmp/main.asc", "main");
remove_file(rootfs + "/tmp/main.asc");
update_main (args);
install_main (base_packages);
foreach (string package in base_packages) {
Expand Down
1 change: 1 addition & 0 deletions src/util/gpg.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public bool verify_file (string path) {
continue;
}
string[] args = {"gpg","--homedir", gpgdir, "--trust-model", "always", "--no-default-keyring", "--keyring", gpgdir+"%s".printf(file), "--quiet" ,"--verify", path+".gpg"};
print_array(args);
int status = run_args (args);
if(status == 0){
return true;
Expand Down

0 comments on commit bf2afc5

Please sign in to comment.