Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 23.10 support #668

Closed
1 change: 1 addition & 0 deletions debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Depends: ${shlibs:Depends}, ssl-cert, ucf, curl, sysstat,
vainfo,
i965-va-driver,
cron,
certbot,
# python3-pip,
#focal php-sqlite3, php-gd, php-curl, php-mysql
#jammy php-sqlite3, php-gd, php-curl, php-mysql
Expand Down
21 changes: 16 additions & 5 deletions installer/v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ jammy_install()
systemctl restart bluecherry
}

# Ubuntu 24.04
noble_install()
{
jammy_install
}

centos_7_install()
{
setenforce 0
Expand All @@ -113,26 +119,29 @@ buster_install()
apt-get -y install gnupg sudo wget
apt-get -y install python3-pip
pip3 install --user --upgrade pip
wget -q https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 -O- | apt-key add -
wget -q https://dl.bluecherrydvr.com/key/bluecherry.asc -O- | apt-key add -
: "${SRCLIST_URL:=https://dl.bluecherrydvr.com/sources.list.d/bluecherry-"$VERSION_CODENAME"-unstable.list}"
wget --output-document=/etc/apt/sources.list.d/bluecherry-"$VERSION_CODENAME".list "$SRCLIST_URL"
apt-get -y update
apt-get -y install mysql-server bluecherry
apt-get -y install default-mysql-server bluecherry
}

# Debian 11
bullseye_install()
{
apt-get -y update
apt-get -y install gnupg sudo sudo python3-distutils wget
wget -q https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 -O- | apt-key add -
wget -q https://dl.bluecherrydvr.com/key/bluecherry.asc -O- | apt-key add -
: "${SRCLIST_URL:=https://dl.bluecherrydvr.com/sources.list.d/bluecherry-"$VERSION_CODENAME"-unstable.list}"
wget --output-document=/etc/apt/sources.list.d/bluecherry-"$VERSION_CODENAME".list "$SRCLIST_URL"
apt-get -y update
apt-get -y install mariadb-server bluecherry
# apt-get install mariadb-server
}

# Debian 12
bookworm_install()
{
bullseye_install
}

check_distro()
Expand Down Expand Up @@ -168,9 +177,11 @@ if [[ "$ID" == "ubuntu" && "$VERSION_ID" == "18.04" && "$VERSION_CODENAME" ==
elif [[ "$ID" == "ubuntu" && "$VERSION_ID" == "20.10" && "$VERSION_CODENAME" == "groovy" ]]; then groovy_install;
elif [[ "$ID" == "ubuntu" && "$VERSION_ID" == "20.04" && "$VERSION_CODENAME" == "focal" ]]; then focal_install;
elif [[ "$ID" == "ubuntu" && "$VERSION_ID" == "22.04" && "$VERSION_CODENAME" == "jammy" ]]; then jammy_install;
elif [[ "$ID" == "ubuntu" && "$VERSION_ID" == "24.04" && "$VERSION_CODENAME" == "noble" ]]; then noble_install;
elif [[ "$ID" == "debian" && "$VERSION_ID" == "10" && "$VERSION_CODENAME" == "buster" ]]; then buster_install;
elif [[ "$ID" == "debian" && "$VERSION_ID" == "11" && "$VERSION_CODENAME" == "bullseye" ]]; then bullseye_install;
elif [[ "$ID" == "debian" && "$VERSION_ID" == "12" && "$VERSION_CODENAME" == "bookworm" ]]; then bookworm_install;
elif [[ "$ID" == "mint" && "$VERSION_ID" == "21.1" && "$VERSION_CODENAME" == "vera" ]]; then jammy_install; # Mint 21.1 Vera, based on Ubuntu 22.04 Jammy
else
echo "Currently we only support Ubuntu 18.04 (Bionic), Ubuntu 20.04 (Focal), Ubuntu 22.04 (Jammy) and Debian 10 (Buster), Linux Mint 21.1 (Vera) for unstable testing"
echo "Currently we only support Ubuntu 18.04 (Bionic), Ubuntu 20.04 (Focal), Ubuntu 22.04 (Jammy), Ubuntu 24.04 (Noble) and Debian 10 (Buster), 11 (Bullseye), 12 (Bookworm), Linux Mint 21.1 (Vera) for unstable testing"
fi
2 changes: 1 addition & 1 deletion lib/lavf_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int lavf_device::start()
if (ctx) return 0;

AVDictionary *avopt_open_input = NULL;
AVInputFormat *input_fmt = NULL;
const AVInputFormat *input_fmt = NULL;

bc_log(Debug, "Opening session from URL: %s", url);

Expand Down
2 changes: 1 addition & 1 deletion lib/v4l2_device_solo6x10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ int v4l2_device_solo6x10::start()
av_dict_set(&open_opts, "input_format", fmtname, 0);
av_dict_set(&open_opts, "format_whitelist", "v4l2", 0);

AVInputFormat *input_fmt = av_find_input_format("v4l2");
const AVInputFormat *input_fmt = av_find_input_format("v4l2");
if (!input_fmt) {
bc_log(Error, "v4l2 input format not found");
return -1;
Expand Down
2 changes: 1 addition & 1 deletion lib/v4l2_device_tw5864.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int v4l2_device_tw5864::start()
av_dict_set(&open_opts, "input_format", "h264", 0);
av_dict_set(&open_opts, "format_whitelist", "v4l2", 0);

AVInputFormat *input_fmt = av_find_input_format("v4l2");
const AVInputFormat *input_fmt = av_find_input_format("v4l2");
if (!input_fmt) {
bc_log(Error, "v4l2 input format not found");
return -1;
Expand Down
2 changes: 1 addition & 1 deletion misc/libav
Submodule libav updated 5286 files
38 changes: 25 additions & 13 deletions misc/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,34 @@ function stop_nginx
function install_pip
{

if [[ $(cat /etc/os-release | grep "UBUNTU" | grep bionic) ]]
then
source /etc/os-release
if [[ "$ID" == ubuntu ]] && [[ "$VERSION_CODENAME" == bionic ]]; then
wget --output-document=/tmp/get-pip.py https://bootstrap.pypa.io/pip/3.6/get-pip.py
python3 /tmp/get-pip.py
else
wget --output-document=/tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
fi
python3 /tmp/get-pip.py
python3 /tmp/get-pip.py
fi
}

function install_certbot
{
source /etc/os-release
if [[ "$ID" == ubuntu ]] && [[ "$VERSION_CODENAME" == noble ]]; then
echo 'For Ubuntu 24.04 (noble) we rely on packaged certbot'
return
elif [[ "$ID" == debian ]] && [[ "$VERSION_CODENAME" == bookworm ]]; then
echo 'For Debian 12 (bookworm) we rely on packaged certbot'
return
fi

install_pip

# Install pip3 dependencies
/usr/local/bin/pip3 install --user --upgrade setuptools_rust certbot certbot-dns-subdomain-provider
/usr/local/bin/pip3 install --user --upgrade pip
/usr/local/bin/pip3 install --user --upgrade cryptography
/usr/local/bin/pip3 install pyopenssl --upgrade
}

function start_apache
Expand Down Expand Up @@ -407,16 +427,8 @@ case "$1" in
if test -f "/usr/share/bluecherry/nginx-includes/subdomain.conf"; then
sed -i 's/snakeoil.conf/subdomain.conf/g' /etc/nginx/sites-enabled/bluecherry.conf
fi

# Install pip from bootstrap

install_pip

# Install pip3 dependencies
/usr/local/bin/pip3 install --user --upgrade setuptools_rust certbot certbot-dns-subdomain-provider
/usr/local/bin/pip3 install --user --upgrade pip
/usr/local/bin/pip3 install --user --upgrade cryptography
/usr/local/bin/pip3 install pyopenssl --upgrade
install_certbot

# Install crontabs for subdomain renewal and SSL renewal using certbot
crontab -l 2>/dev/null || true; printf "* * */5 * * certbot renew --config-dir=/usr/share/bluecherry/nginx-includes/letsencrypt/ >/dev/null 2>&1\n*/5 * * * * curl -k https://localhost:7001/subdomainprovidercron >/dev/null 2>&1\n" | crontab -
Expand Down
10 changes: 10 additions & 0 deletions nginx-configs/php/bookworm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi.conf;
set $path_info $fastcgi_path_info;
fastcgi_read_timeout 300;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_index index.php;
}
1 change: 1 addition & 0 deletions nginx-configs/php/noble.conf
78 changes: 1 addition & 77 deletions server/ffmpeg-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,6 @@
#include <libavcodec/avcodec.h>
#include "logc.h"

/* Fake H.264 encoder for libavcodec. We're only muxing video, never reencoding,
* so a real encoder isn't neeeded, but one must be present for the process to
* succeed. ffmpeg does not support h264 encoding without libx264, which is GPL.
*/
static int fake_h264_init(AVCodecContext *ctx)
{
(void)ctx;
return 0;
}

static int fake_h264_close(AVCodecContext *ctx)
{
(void)ctx;
return 0;
}

static int fake_h264_frame(AVCodecContext *ctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
(void)ctx;
(void)avpkt;
(void)frame;
(void)got_packet_ptr;
return -1;
}

static AVCodec fake_h264_encoder = {
.name = "fakeh264",
.long_name = "Fake H.264 Encoder for RTP Muxing",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
.priv_data_size = 0,
.init = fake_h264_init,
.encode2 = fake_h264_frame,
.close = fake_h264_close,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_NONE
},
};


/* Warning: Must be reentrant; this may be called from many device threads at
* once */
Expand All @@ -92,49 +50,15 @@ static void av_log_cb(void *avcl, int level, const char *fmt, va_list ap)
bc_vlog(bc_level, msg, ap);
}

static int bc_av_lockmgr(void **mutex_p, enum AVLockOp op)
{
pthread_mutex_t **mutex = (pthread_mutex_t**)mutex_p;
switch (op) {
case AV_LOCK_CREATE:
*mutex = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
if (!*mutex)
return 1;
return !!pthread_mutex_init(*mutex, NULL);

case AV_LOCK_OBTAIN:
return !!pthread_mutex_lock(*mutex);

case AV_LOCK_RELEASE:
return !!pthread_mutex_unlock(*mutex);

case AV_LOCK_DESTROY:
pthread_mutex_destroy(*mutex);
free(*mutex);
return 0;
}

return 1;
}

void bc_ffmpeg_init()
{
if (av_lockmgr_register(bc_av_lockmgr)) {
bc_log(Fatal, "libav lock registration failed");
exit(1);
}

avcodec_register(&fake_h264_encoder); // deprecated
av_register_all(); // deprecated
avfilter_register_all(); // deprecated
avformat_network_init();
avdevice_register_all();
avcodec_register_all(); // deprecated

av_log_set_callback(av_log_cb);
}

void bc_ffmpeg_teardown()
{
av_lockmgr_register(NULL); // deprecated
;
}
4 changes: 2 additions & 2 deletions server/media_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ int media_writer::open(const std::string &path, const stream_properties &propert
AVCodec *codec;

/* Get the output format */
AVOutputFormat *fmt_out = av_guess_format("mp4", NULL, "video/mp4");
const AVOutputFormat *fmt_out = av_guess_format("mp4", NULL, "video/mp4");
if (fmt_out == NULL)
{
bc_log(Error, "media_writer: MP4 output format is not found!");
Expand Down Expand Up @@ -707,4 +707,4 @@ int snapshot_writer::write_frame(AVFrame *rawFrame)

///////////////////////////////////////////////////////////////
// S.K. >> END-OF: Implementation of separated snapshot writer
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
2 changes: 1 addition & 1 deletion utils/BCMK
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ clean:
install: licensecmd ptzcmd
$(INSTALL_PROG) -D licensecmd $(DESTDIR)$(libexec_dir)/licensecmd
$(INSTALL_PROG) -D ptzcmd $(DESTDIR)$(libexec_dir)/ptzcmd
$(INSTALL_PROG) -D onvif_tool $(DESTDIR)$(libexec_dir)/onvif_tool
$(INSTALL_PROG) -D onvif_tool $(DESTDIR)$(libexec_dir)/onvif_tool || true
Loading