unpacks and adds binaries to bin
This commit is contained in:
parent
cdc3bdc1e0
commit
39d7554686
5 changed files with 199 additions and 9 deletions
146
.BUILDINFO
Normal file
146
.BUILDINFO
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
format = 1
|
||||||
|
pkgname = bash
|
||||||
|
pkgbase = bash
|
||||||
|
pkgver = 5.0.009-1
|
||||||
|
pkgarch = x86_64
|
||||||
|
pkgbuild_sha256sum = 39e68624cc77daf37535bff3c61859c51e80134c41af1ae805ff4a3e3ce439f7
|
||||||
|
packager = Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
|
||||||
|
builddate = 1566072386
|
||||||
|
builddir = /build
|
||||||
|
buildenv = !distcc
|
||||||
|
buildenv = color
|
||||||
|
buildenv = !ccache
|
||||||
|
buildenv = check
|
||||||
|
buildenv = !sign
|
||||||
|
options = strip
|
||||||
|
options = docs
|
||||||
|
options = !libtool
|
||||||
|
options = !staticlibs
|
||||||
|
options = emptydirs
|
||||||
|
options = zipman
|
||||||
|
options = purge
|
||||||
|
options = !debug
|
||||||
|
installed = acl-2.2.53-1-x86_64
|
||||||
|
installed = archlinux-keyring-20190805-1-any
|
||||||
|
installed = argon2-20190702-1-x86_64
|
||||||
|
installed = attr-2.4.48-1-x86_64
|
||||||
|
installed = audit-2.8.5-3-x86_64
|
||||||
|
installed = autoconf-2.69-5-any
|
||||||
|
installed = automake-1.16.1-1-any
|
||||||
|
installed = bash-5.0.007-1-x86_64
|
||||||
|
installed = binutils-2.32-2-x86_64
|
||||||
|
installed = bison-3.4-1-x86_64
|
||||||
|
installed = bzip2-1.0.8-2-x86_64
|
||||||
|
installed = ca-certificates-20181109-1-any
|
||||||
|
installed = ca-certificates-mozilla-3.45-1-x86_64
|
||||||
|
installed = ca-certificates-utils-20181109-1-any
|
||||||
|
installed = coreutils-8.31-1-x86_64
|
||||||
|
installed = cracklib-2.9.7-1-x86_64
|
||||||
|
installed = cryptsetup-2.2.0-1-x86_64
|
||||||
|
installed = curl-7.65.3-1-x86_64
|
||||||
|
installed = db-5.3.28-4-x86_64
|
||||||
|
installed = dbus-1.12.16-2-x86_64
|
||||||
|
installed = device-mapper-2.02.185-1-x86_64
|
||||||
|
installed = diffutils-3.7-1-x86_64
|
||||||
|
installed = e2fsprogs-1.45.3-1-x86_64
|
||||||
|
installed = expat-2.2.7-1-x86_64
|
||||||
|
installed = fakeroot-1.23-1-x86_64
|
||||||
|
installed = file-5.37-2-x86_64
|
||||||
|
installed = filesystem-2019.05-2-x86_64
|
||||||
|
installed = findutils-4.6.0-4-x86_64
|
||||||
|
installed = flex-2.6.4-2-x86_64
|
||||||
|
installed = gawk-4.2.1-2-x86_64
|
||||||
|
installed = gc-7.6.8-1-x86_64
|
||||||
|
installed = gcc-9.1.0-2-x86_64
|
||||||
|
installed = gcc-libs-9.1.0-2-x86_64
|
||||||
|
installed = gdbm-1.18.1-2-x86_64
|
||||||
|
installed = gettext-0.20.1-1-x86_64
|
||||||
|
installed = glib2-2.60.6-1-x86_64
|
||||||
|
installed = glibc-2.29-4-x86_64
|
||||||
|
installed = gmp-6.1.2-2-x86_64
|
||||||
|
installed = gnupg-2.2.17-2-x86_64
|
||||||
|
installed = gnutls-3.6.9-1-x86_64
|
||||||
|
installed = gpgme-1.13.1-1-x86_64
|
||||||
|
installed = grep-3.3-1-x86_64
|
||||||
|
installed = groff-1.22.4-1-x86_64
|
||||||
|
installed = guile-2.2.6-1-x86_64
|
||||||
|
installed = gzip-1.10-1-x86_64
|
||||||
|
installed = hwids-20190316-1-any
|
||||||
|
installed = iana-etc-20190722-1-any
|
||||||
|
installed = icu-64.2-1-x86_64
|
||||||
|
installed = iptables-1:1.8.3-1-x86_64
|
||||||
|
installed = json-c-0.13.1-2-x86_64
|
||||||
|
installed = kbd-2.0.4-2-x86_64
|
||||||
|
installed = keyutils-1.6.1-1-x86_64
|
||||||
|
installed = kmod-26-2-x86_64
|
||||||
|
installed = krb5-1.17-1-x86_64
|
||||||
|
installed = less-551-1-x86_64
|
||||||
|
installed = libarchive-3.4.0-2-x86_64
|
||||||
|
installed = libassuan-2.5.3-1-x86_64
|
||||||
|
installed = libatomic_ops-7.6.10-1-x86_64
|
||||||
|
installed = libcap-2.27-1-x86_64
|
||||||
|
installed = libcap-ng-0.7.9-1-x86_64
|
||||||
|
installed = libcroco-0.6.13-1-x86_64
|
||||||
|
installed = libelf-0.176-1-x86_64
|
||||||
|
installed = libffi-3.2.1-3-x86_64
|
||||||
|
installed = libgcrypt-1.8.4-1-x86_64
|
||||||
|
installed = libgpg-error-1.36-1-x86_64
|
||||||
|
installed = libidn2-2.2.0-1-x86_64
|
||||||
|
installed = libksba-1.3.5-1-x86_64
|
||||||
|
installed = libldap-2.4.48-1-x86_64
|
||||||
|
installed = libmnl-1.0.4-2-x86_64
|
||||||
|
installed = libmpc-1.1.0-1-x86_64
|
||||||
|
installed = libnetfilter_conntrack-1.0.7-1-x86_64
|
||||||
|
installed = libnfnetlink-1.0.1-3-x86_64
|
||||||
|
installed = libnftnl-1.1.3-1-x86_64
|
||||||
|
installed = libnghttp2-1.39.2-1-x86_64
|
||||||
|
installed = libnl-3.4.0-1-x86_64
|
||||||
|
installed = libpcap-1.9.0-1-x86_64
|
||||||
|
installed = libpsl-0.21.0-1-x86_64
|
||||||
|
installed = libsasl-2.1.27-1-x86_64
|
||||||
|
installed = libseccomp-2.4.1-2-x86_64
|
||||||
|
installed = libsecret-0.18.8-2-x86_64
|
||||||
|
installed = libssh2-1.8.2-1-x86_64
|
||||||
|
installed = libtasn1-4.14-1-x86_64
|
||||||
|
installed = libtirpc-1.1.4-1-x86_64
|
||||||
|
installed = libtool-2.4.6+42+gb88cebd5-5-x86_64
|
||||||
|
installed = libunistring-0.9.10-1-x86_64
|
||||||
|
installed = libusb-1.0.22-1-x86_64
|
||||||
|
installed = libutil-linux-2.34-3-x86_64
|
||||||
|
installed = libxml2-2.9.9-2-x86_64
|
||||||
|
installed = linux-api-headers-5.1-1-any
|
||||||
|
installed = lz4-1:1.9.1-1-x86_64
|
||||||
|
installed = m4-1.4.18-2-x86_64
|
||||||
|
installed = make-4.2.1-3-x86_64
|
||||||
|
installed = mpfr-4.0.2-1-x86_64
|
||||||
|
installed = ncurses-6.1-6-x86_64
|
||||||
|
installed = nettle-3.5.1-1-x86_64
|
||||||
|
installed = npth-1.6-1-x86_64
|
||||||
|
installed = openssl-1.1.1.c-1-x86_64
|
||||||
|
installed = p11-kit-0.23.16.1-1-x86_64
|
||||||
|
installed = pacman-5.1.3-1-x86_64
|
||||||
|
installed = pacman-mirrorlist-20190614-1-any
|
||||||
|
installed = pam-1.3.1-1-x86_64
|
||||||
|
installed = pambase-20190105.1-1-any
|
||||||
|
installed = patch-2.7.6-7-x86_64
|
||||||
|
installed = pcre-8.43-1-x86_64
|
||||||
|
installed = pcre2-10.33-1-x86_64
|
||||||
|
installed = perl-5.30.0-3-x86_64
|
||||||
|
installed = pinentry-1.1.0-4-x86_64
|
||||||
|
installed = pkgconf-1.6.3-1-x86_64
|
||||||
|
installed = popt-1.16-10-x86_64
|
||||||
|
installed = readline-8.0.0-1-x86_64
|
||||||
|
installed = sed-4.7-1-x86_64
|
||||||
|
installed = shadow-4.7-2-x86_64
|
||||||
|
installed = sqlite-3.29.0-1-x86_64
|
||||||
|
installed = sudo-1.8.27-1-x86_64
|
||||||
|
installed = systemd-242.84-2-x86_64
|
||||||
|
installed = systemd-libs-242.84-2-x86_64
|
||||||
|
installed = tar-1.32-1-x86_64
|
||||||
|
installed = texinfo-6.6-1-x86_64
|
||||||
|
installed = tzdata-2019b-1-x86_64
|
||||||
|
installed = util-linux-2.34-3-x86_64
|
||||||
|
installed = which-2.21-3-x86_64
|
||||||
|
installed = xz-5.2.4-1-x86_64
|
||||||
|
installed = zlib-1:1.2.11-3-x86_64
|
||||||
|
installed = zstd-1.4.2-1-x86_64
|
BIN
.MTREE
Normal file
BIN
.MTREE
Normal file
Binary file not shown.
23
.PKGINFO
Normal file
23
.PKGINFO
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by makepkg 5.1.3
|
||||||
|
# using fakeroot version 1.23
|
||||||
|
pkgname = bash
|
||||||
|
pkgbase = bash
|
||||||
|
pkgver = 5.0.009-1
|
||||||
|
pkgdesc = The GNU Bourne Again shell
|
||||||
|
url = https://www.gnu.org/software/bash/bash.html
|
||||||
|
builddate = 1566072386
|
||||||
|
packager = Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
|
||||||
|
size = 8423424
|
||||||
|
arch = x86_64
|
||||||
|
license = GPL
|
||||||
|
group = base
|
||||||
|
provides = sh
|
||||||
|
backup = etc/bash.bashrc
|
||||||
|
backup = etc/bash.bash_logout
|
||||||
|
backup = etc/skel/.bashrc
|
||||||
|
backup = etc/skel/.bash_profile
|
||||||
|
backup = etc/skel/.bash_logout
|
||||||
|
depend = readline>=7.0
|
||||||
|
depend = glibc
|
||||||
|
depend = ncurses
|
||||||
|
optdepend = bash-completion: for tab completion
|
BIN
pack
BIN
pack
Binary file not shown.
39
src/main.rs
39
src/main.rs
|
@ -1,14 +1,11 @@
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::io::Read;
|
|
||||||
use std::result::Result;
|
use std::result::Result;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
use reqwest::IntoUrl;
|
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use reqwest::header::ETAG;
|
use reqwest::header::ETAG;
|
||||||
|
|
||||||
use smush::decode;
|
|
||||||
|
|
||||||
fn main() -> Result<(), std::io::Error> {
|
fn main() -> Result<(), std::io::Error> {
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
|
|
||||||
|
@ -31,14 +28,14 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
let full_path: Vec<&str> = vec[0].split("/").collect();
|
let full_path: Vec<&str> = vec[0].split("/").collect();
|
||||||
let pkgname = full_path[full_path.len() - 1];
|
let pkgname = full_path[full_path.len() - 1];
|
||||||
let repo = match vec[1] {
|
let repo = match vec[1] {
|
||||||
"arch" => "http://mirrors.advancedhosters.com/archlinux/core/os/x86_64/",
|
"arch_core" => "http://mirrors.advancedhosters.com/archlinux/core/os/x86_64/",
|
||||||
_ => {
|
_ => {
|
||||||
println!("Repo {} is not supported...", vec[1]);
|
println!("Repo {} is not supported...", vec[1]);
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
print!("Making request...");
|
print!("[PACK]: Making request...");
|
||||||
let url = reqwest::Url::parse(&(repo.to_string() + pkgname)).expect("Failed to parse URL");
|
let url = reqwest::Url::parse(&(repo.to_string() + pkgname)).expect("Failed to parse URL");
|
||||||
let mut resp = client.get(url)
|
let mut resp = client.get(url)
|
||||||
.send().expect("Failed to make request");
|
.send().expect("Failed to make request");
|
||||||
|
@ -64,9 +61,33 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut archive = File::open(format!("/usr/pack/repo/{}/tarballs/{}", vec[1], pkgname)).expect("Failed to open tar...");
|
let spltdirname: Vec<&str> = pkgname.split(".").collect();
|
||||||
let mut tar = Vec::new();
|
let dirname = spltdirname[0];
|
||||||
archive.read_to_end(&mut tar).expect("Failed to read tar...");
|
|
||||||
|
print!("[PACK]: Creating package dir...");
|
||||||
|
std::fs::create_dir(format!("/usr/pack/repo/{}/{}", vec[1], dirname)).expect("Failed to create directory");
|
||||||
|
println!("OK");
|
||||||
|
|
||||||
|
print!("[PACK]: Executing tar...");
|
||||||
|
let cmd = Command::new("tar")
|
||||||
|
.arg(format!("-C/usr/pack/repo/{}/{}", vec[1], dirname))
|
||||||
|
.arg("-xf")
|
||||||
|
.arg(format!("/usr/pack/repo/{}/tarballs/{}", vec[1], pkgname))
|
||||||
|
.output()
|
||||||
|
.expect("Failed to execute tar");
|
||||||
|
println!("OK");
|
||||||
|
|
||||||
|
let paths = std::fs::read_dir(format!("/usr/pack/repo/{}/{}/usr/bin/", vec[1], dirname)).expect("Failed to read dir...");
|
||||||
|
println!("[PACK]: Creating symlinks");
|
||||||
|
for file in paths {
|
||||||
|
let pth = &file.expect("Failed to read file").path();
|
||||||
|
let strpth = pth.to_str().expect("Failed to convert to str...");
|
||||||
|
println!("\tAdding file {} to /usr/pack/bin/", strpth);
|
||||||
|
|
||||||
|
let a: Vec<&str> = strpth.split("/").collect();
|
||||||
|
let name = a[a.len() - 1];
|
||||||
|
std::os::unix::fs::symlink(pth, format!("/usr/pack/bin/{}", name));
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue