Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mryel00 committed Nov 7, 2023
1 parent 2bdc30b commit e247478
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions custompios/crowsnest/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ is_raspbian() {
get_pkglist() {
if [[ "$(is_raspbian)" = "1" ]]; then
CN_BUILD_INSTALL_SH="/home/${BASE_USER}/crowsnest/tools/libs/pkglist-rpi.sh"
fi
if [[ "$(is_raspbian)" = "0" ]]; then
INSTALL_CS="1"
else
CN_BUILD_INSTALL_SH="/home/${BASE_USER}/crowsnest/tools/libs/pkglist-generic.sh"
fi
}
Expand Down
17 changes: 8 additions & 9 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,13 @@ main() {

[[ -n "${BASE_USER}" ]] || BASE_USER="${SUDO_USER}"

[[ -n "${INSTALL_CS}" ]] || INSTALL_CS="$(shallow_cs_dependencies_check)"

if [[ "$(is_buster)" = "1" ]]; then
if [[ "$(is_buster)" = "1" && "${INSTALL_CS}" == "1" ]]; then
not_supported_msg
exit 1
fi

if [[ "$(is_raspbian)" = "1" ]]; then
link_pkglist_rpi
fi

if [[ "$(is_raspbian)" = "0" ]]; then
link_pkglist_generic
fi

welcome_msg

msg "Running apt-get update first ...\n"
Expand All @@ -72,6 +65,12 @@ main() {
status_msg "Running apt-get update first ..." "1"
fi

if [[ "$(is_raspberry_pi)" = "1" && "${INSTALL_CS}" = "1" ]]; then
link_pkglist_rpi
else
link_pkglist_generic
fi

source_pkglist_file
msg "Installing dependencies ...\n"
if install_dependencies ;then
Expand Down
21 changes: 21 additions & 0 deletions tools/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ is_raspbian() {
fi
}

test_load_module() {
if modprobe -n "${1}" &> /dev/null; then
echo 1
else
echo 0
fi
}

shallow_cs_dependencies_check() {
# Update the number below if you update SHALLOW_CHECK_PKGLIST
SHALLOW_CHECK_PKGLIST="^(libavformat-dev|libavutil-dev|libavcodec-dev|libcamera-dev|libcamera-apps-lite)$"
SHALLOW_CHECK_MODULESLIST="bcm2835_codec"

if [[ $(apt-cache search --names-only "${SHALLOW_CHECK_PKGLIST}") -eq 5
&& $(test_load_module ${SHALLOW_CHECK_MODULESLIST}) ]]; then
echo 1
else
echo 0
fi
}

link_pkglist_rpi() {
sudo -u "${BASE_USER}" ln -sf "${SRC_DIR}/libs/pkglist-rpi.sh" "${SRC_DIR}/pkglist.sh" &> /dev/null || return 1
}
Expand Down

0 comments on commit e247478

Please sign in to comment.