From 732d1963ed83abf4e5f1b06ec451a6943421d716 Mon Sep 17 00:00:00 2001 From: Guo Wenxue <guowenxue@gmail.com> Date: Thu, 22 Sep 2022 00:36:11 +0800 Subject: [PATCH] update ds18b20.c to snprintf --- tools/setup_systools.sh | 71 ++++++++++++++++++++++++++++++++++- 1 files changed, 68 insertions(+), 3 deletions(-) diff --git a/tools/setup_systools.sh b/tools/setup_systools.sh index 63e0733..6ef04a3 100755 --- a/tools/setup_systools.sh +++ b/tools/setup_systools.sh @@ -1,7 +1,72 @@ #!/bin/bash -sudo apt update +# display in red +function pr_error() { + echo "" + echo -e "\033[40;31m --E-- $1 \033[0m" + echo "" +} -sudo apt install -y make vim gawk wget curl unzip sed tree coreutils diffstat git subversion groff lzop \ -make gcc g++ libtool automake autoconf autoconf-archive flex texinfo build-essential libelf-dev bison libssl1.1* +# display in yellow +function pr_warn() { + echo "" + echo -e "\033[40;33m --W-- $1 \033[0m" + echo "" +} + +# display in green +function pr_info() { + echo "" + echo -e "\033[40;32m --I-- $1 \033[0m" + echo "" +} + +function update_source() +{ + APT_FILE=/etc/apt/sources.list + + pr_warn "start update apt source to ustc" + + if [ ! -f $APT_FILE.orig ] ; then + mv $APT_FILE $APT_FILE.orig + fi + +cat > $APT_FILE <<EOF +deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ bullseye main contrib non-free rpi +deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ bullseye main contrib non-free rpi +EOF +} + +function apt_update() +{ + pr_warn "start update apt updata and upgrade" + + apt update + apt upgrade -y + apt autoremove -y +} + +function apt_install() +{ + pr_warn "start apt install system tools" + + apt install -y make vim gawk wget curl unzip sed tree coreutils diffstat git subversion \ + groff lzop make gcc g++ libtool automake autoconf autoconf-archive flex texinfo bison \ + build-essential libelf-dev lrzsz + + # apt-cache policy libssl-dev + apt install -y libssl-dev=1.1.1n-0+deb11u1 libssl1.1 +} + +if [ `id -u` != 0 ] ; then + pr_error "This shell script must run as root." + exit 1; +fi + +update_source + +apt_update + +apt_install + -- Gitblit v1.9.1