Skip to content

Commit c589c26

Browse files
Nabil-Salahashraffouda
authored andcommitted
feat: add lshw binary script and workflow install
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
1 parent d9e60b5 commit c589c26

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/bins.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ jobs:
9595
# package: tpm
9696
# secrets:
9797
# token: ${{ secrets.HUB_JWT }}
98+
lshw:
99+
uses: ./.github/workflows/bin-package.yaml
100+
with:
101+
package: lshw
102+
secrets:
103+
token: ${{ secrets.HUB_JWT }}
98104
qsfs:
99105
uses: ./.github/workflows/bin-package-no-tag.yaml
100106
with:

bins/packages/lshw/lshw.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
LSHW_VERSION="B.02.20"
2+
LSHW_CHECKSUM="5805eba5f31886582fff673c5dccdb3b"
3+
LSHW_LINK="https://github.com/lyonel/lshw/archive/refs/tags/${LSHW_VERSION}.tar.gz"
4+
5+
download_lshw() {
6+
download_file $LSHW_LINK $LSHW_CHECKSUM lshw-${LSHW_VERSION}.tar.gz
7+
}
8+
9+
dependencies_lshw() {
10+
apt-get install -y build-essential gcc g++ make
11+
}
12+
13+
extract_lshw() {
14+
if [ ! -d "lshw-${LSHW_VERSION}" ]; then
15+
echo "[+] extracting: lshw-${LSHW_VERSION}"
16+
tar -xf ${DISTDIR}/lshw-${LSHW_VERSION}.tar.gz -C .
17+
fi
18+
}
19+
20+
prepare_lshw() {
21+
echo "[+] configuring lshw"
22+
}
23+
24+
compile_lshw() {
25+
pushd src
26+
make -C core ${MAKEOPTS} VERSION="${LSHW_VERSION}"
27+
make ${MAKEOPTS} VERSION="${LSHW_VERSION}" LDFLAGS="-static -L./core/" CXXFLAGS="-g -Wall -I./core/ -fno-pie"
28+
popd
29+
}
30+
31+
install_lshw() {
32+
echo "[+] installing lshw to initramfs"
33+
34+
mkdir -p "${ROOTDIR}/usr/sbin"
35+
mkdir -p "${ROOTDIR}/usr/share/man/man1"
36+
mkdir -p "${ROOTDIR}/usr/share/lshw"
37+
38+
cp src/lshw "${ROOTDIR}/usr/sbin/"
39+
chmod +x "${ROOTDIR}/usr/sbin/lshw"
40+
41+
cp src/lshw.1 "${ROOTDIR}/usr/share/man/man1/"
42+
cp src/pci.ids src/usb.ids src/oui.txt src/manuf.txt src/pnp.ids src/pnpid.txt "${ROOTDIR}/usr/share/lshw/"
43+
}
44+
45+
build_lshw() {
46+
dependencies_lshw
47+
48+
pushd "${DISTDIR}"
49+
download_lshw
50+
popd
51+
52+
pushd "${WORKDIR}"
53+
extract_lshw
54+
55+
pushd "lshw-${LSHW_VERSION}"
56+
prepare_lshw
57+
compile_lshw
58+
install_lshw
59+
popd
60+
61+
popd
62+
}

0 commit comments

Comments
 (0)