欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Linux 操作与维护_Bash 脚本_编译并安装 FreeRDP-3.3.0

最编程 2024-03-14 06:57:15
...
#! /bin/bash # Create By GF 2024-03-13 22:22 # -------------------------------------------------- # Install First: # * GNU-Tools (Contains: pkg-config, m4, autoconf, automake, libtool, gettext, flex, bison, libiconv, make) # * CMake >= 3.14.0 # * Python == 3.x.x # * Meson # * Ninja # * X11 # * Glib # * Pango == 1.51.x (Contains: Fribidi, FreeType, Fontconfig / Needed by libinput) # * FFmpeg >= 6.0 # ------------------- Dependency ------------------- # Need File: eudev-3.2.14.tar.gz # Need File: pkcs11-helper-1.30.0.tar.bz2 # Need File: e2fsprogs-1.45.5.tar.gz # Need File: krb5-1.21.2.tar.gz # Need File: icu4c-74_2-src.tgz # Need File: libusb-1.0.27.tar.bz2 (Needed by Cups) # Need File: cups-2.4.7-source.tar.gz # Need File: fuse-3.16.2.tar.gz # -------------------- FreeRDP --------------------- # Need File: freerdp-3.3.0.tar.gz # ################################################## # Recommended Optional Installation # * GnuTLS-3.7.0 (GnuTLS是一个安全的通信库, 实现 SSL, TLS 和 DTLS 协议及其周围的技术。它提供了用于访问安全通信协议的简单 C语言 应用程序编程接口 (API), 以及用于解析和编写 X.509, PKCS 和其他所需结构的API。) # ################################################## STORAGE=/home/goufeng # ############################################ Dependency ############################################ # Function: 编译安装(Compile Install) eudev-3.2.14 # ################################################## function Compile_Install_eudev_3_2_14() { # Attention: may conflict with the original "udev" in the system. # 注意: 可能与系统原有的 "udev" 冲突。 # eudev 提供针对内核提供的 udev 设备管理服务的函数库。 # udev 是 Linux 2.6 内核的设备管理器。 # udev 它在 /dev 目录下动态地 创建/移除 设备节点, 用于在系统中传递解决方案的有关设备信息, 以及在出现设备事件 (如删除、插入设备) 时触发相应的操作。 if [[ ! -d "/opt/eudev-3.2.14" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_BUILDED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( eudev-3.2.14 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ------------------------------------------ tar -zxvf $STORAGE/eudev-3.2.14.tar.gz && STEP_UNZIPPED=1 # ------------------------------------------ cd $STORAGE/eudev-3.2.14 && ./configure --prefix=/opt/eudev-3.2.14 && STEP_BUILDED=1 # ------------------------------------------ make && make install && STEP_INSTALLED=1 # ------------------------------------------ if [[ $STEP_INSTALLED == 1 ]]; then if [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fi if [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi # Skip # if [[ ! -d "/usr/local/sbin" ]]; then mkdir /usr/local/sbin; fi # ...................................... # Skip # ln -sf /opt/eudev-3.2.14/bin/udevadm /usr/local/bin/ # Skip # ln -sf /opt/eudev-3.2.14/bin/udevadm /usr/local/sbin/udevadm # ...................................... # Skip # ln -sf /opt/eudev-3.2.14/sbin/udevd /usr/local/sbin/ # ...................................... # Skip # rsync -av /opt/eudev-3.2.14/include/ /usr/local/include/ # Skip # rsync -av /opt/eudev-3.2.14/lib/ /usr/local/lib/ # ...................................... cp -f /opt/eudev-3.2.14/lib/pkgconfig/libudev.pc /opt/lib/pkgconfig/ fi # ------------------------------------------ cd $STORAGE && rm -rf $STORAGE/eudev-3.2.14 && return 0 else echo "[Caution] Path: ( /opt/eudev-3.2.14 ) Already Exists." # ------------------------------------------ return 0 fi } # Function: 编译安装(Compile Install) pkcs11-helper-1.30.0 # ################################################## function Compile_Install_pkcs11_helper_1_30_0() { if [[ ! -d "/opt/pkcs11-helper-1.30.0" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_CONFIGURED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( pkcs11-helper-1.30.0 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ------------------------------------------ tar -jxvf $STORAGE/pkcs11-helper-1.30.0.tar.bz2 && STEP_UNZIPPED=1 # ------------------------------------------ cd $STORAGE/pkcs11-helper-1.30.0 && ./configure --prefix=/opt/pkcs11-helper-1.30.0 \ PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \ STEP_CONFIGURED=1 # ------------------------------------------ make && make install && STEP_INSTALLED=1 # ------------------------------------------ if [[ $STEP_INSTALLED == 1 ]]; then if [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fi if [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi # ...................................... rsync -av /opt/pkcs11-helper-1.30.0/include/ /usr/local/include/ rsync -av /opt/pkcs11-helper-1.30.0/lib/ /usr/local/lib/ # ...................................... cp -f /opt/pkcs11-helper-1.30.0/lib/pkgconfig/libpkcs11-helper-1.pc /opt/lib/pkgconfig/ fi # ------------------------------------------ cd $STORAGE && rm -rf $STORAGE/pkcs11-helper-1.30.0 && return 0 else echo "[Caution] Path: ( /opt/pkcs11-helper-1.30.0 ) Already Exists." # ------------------------------------------ return 0 fi } # Function: 编译安装(Compile Install) e2fsprogs-1.45.5 # ################################################## function Compile_Install_e2fsprogs_1_45_5() { # e2fsprogs-1.45.5 Provide: chattr (Binary File) # e2fsprogs-1.45.5 Provide: compile_et (Binary File) # e2fsprogs-1.45.5 Provide: lsattr (Binary File) # e2fsprogs-1.45.5 Provide: mk_cmds (Binary File) # e2fsprogs-1.45.5 Provide: uuidgen (Binary File) # e2fsprogs-1.45.5 Provide: libblkid.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libblkid.so (Shared Libraries) # e2fsprogs-1.45.5 Provide: libcom_err.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libcom_err.so (Shared Libraries) # e2fsprogs-1.45.5 Provide: libe2p.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libe2p.so (Shared Libraries) # e2fsprogs-1.45.5 Provide: libext2fs.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libext2fs.so (Shared Libraries) # e2fsprogs-1.45.5 Provide: libss.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libss.so (Shared Libraries) # e2fsprogs-1.45.5 Provide: libuuid.a (Static Libraries) # e2fsprogs-1.45.5 Provide: libuuid.so (Shared Libraries) if [[ ! -d "/opt/e2fsprogs-1.45.5" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_CONFIGURED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( e2fsprogs-1.45.5 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ------------------------------------------ tar -zxvf $STORAGE/e2fsprogs-1.45.5.tar.gz && STEP_UNZIPPED=1 # ------------------------------------------ # * Option: --enable-elf-shlibs: select ELF shared libraries # .......................................... # * Option: --enable-bsd-shlibs: select BSD shared libraries cd $STORAGE/e2fsprogs-1.45.5 && ./configure --prefix=/opt/e2fsprogs-1.45.5 \ --enable-elf-shlibs \ PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \ STEP_CONFIGURED=1 # ------------------------------------------ make && make install && STEP_INSTALLED=1 # ------------------------------------------ if [[ $STEP_INSTALLED == 1 ]]; then # Skip # if [[ ! -d "/usr/local/sbin" ]]; then mkdir /usr/local/sbin; fi # ...................................... if [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fi if [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi # ...................................... # Skip # ln -sf /opt/e2fsprogs-1.45.5/bin/* /usr/local/bin/ # ...................................... # Skip # ln -sf /opt/e2fsprogs-1.45.5/sbin/* /usr/local/sbin/ # ...................................... # Skip # rsync -av /opt/e2fsprogs-1.45.5/include/ /usr/local/include/ # Skip # rsync -av /opt/e2fsprogs-1.45.5/lib/ /usr/local/lib/ # ...................................... cp -f /opt/e2fsprogs-1.45.5/lib/pkgconfig/*.pc /opt/lib/pkgconfig/ fi # ------------------------------------------ cd $STORAGE && rm -rf $STORAGE/e2fsprogs-1.45.5 && return 0 else echo "[Caution] Path: ( /opt/e2fsprogs-1.45.5 ) Already Exists." # ------------------------------------------ return 0 fi } # Function: 编译安装(Compile Install) MIT-Kerberos-V5-1.21.2 # ################################################## function Compile_Install_MIT_Kerberos_V5_1_21_2() { # Configuring MIT Kerberos V5 # # Config Files # # /etc/krb5.conf and /var/lib/krb5kdc/kdc.conf # # Configuration Information # # Kerberos Configuration # # Tip # # You should consider installing some sort of password checking dictionary so that you can configure the installation to only accept strong passwords. # A suitable dictionary to use is shown in the CrackLib-2.9.11 instructions. Note that only one file can be used, but you can concatenate many files into one. # The configuration file shown below assumes you have installed a dictionary to /usr/share/dict/words. # # Create the Kerberos configuration file with the following commands issued by the root user: # # cat > /etc/krb5.conf << "EOF" # # Begin /etc/krb5.conf # # [libdefaults] # default_realm = <EXAMPLE.ORG> # encrypt = true # # [realms] # <EXAMPLE.ORG> = { # kdc = <belgarath.example.org> # admin_server = <belgarath.example.org> # dict_file = /usr/share/dict/words # } # # [domain_realm] # .<example.org> = <EXAMPLE.ORG> # # [logging] # kdc = SYSLOG:INFO:AUTH # admin_server = SYSLOG:INFO:AUTH # default = SYSLOG:DEBUG:DAEMON # # # End /etc/krb5.conf # EOF # You will need to substitute your domain and proper hostname for the occurrences of the <belgarath> and <example.org> names. # # default_realm should be the name of your domain changed to ALL CAPS. This isn't required, but both Heimdal and MIT recommend it. # # encrypt = true provides encryption of all traffic between kerberized clients and servers. It's not necessary and can be left off. If you leave it off, you can encrypt all traffic from the client to the server using a switch on the client program instead. # # The [realms] parameters tell the client programs where to look for the KDC authentication services. # # The [domain_realm] section maps a domain to a realm. # # Create the KDC database: # # kdb5_util create -r <EXAMPLE.ORG> -s # Now you should populate the database with principals (users). For now, just use your regular login name or root. # # kadmin.local # kadmin.local: add_policy dict-only # kadmin.local: addprinc -policy dict-only <loginname> # The KDC server and any machine running kerberized server daemons must have a host key installed: # # kadmin.local: addprinc -randkey host/<belgarath.example.org> # After choosing the defaults when prompted, you will have to export the data to a keytab file: # # kadmin.local: ktadd host/<belgarath.example.org> # This should have created a file in /etc named krb5.keytab (Kerberos 5). This file should have 600 (root rw only) permissions. Keeping the keytab files from public access is crucial to the overall security of the Kerberos installation. # # Exit the kadmin program (use quit or exit) and return back to the shell prompt. Start the KDC daemon manually, just to test out the installation: # # /usr/sbin/krb5kdc # Attempt to get a ticket with the following command: # # kinit <loginname> # You will be prompted for the password you created. After you get your ticket, you can list it with the following command: # # klist # Information about the ticket should be displayed on the screen. # # To test the functionality of the keytab file, issue the following command as the root user: # # ktutil # ktutil: rkt /etc/krb5.keytab # ktutil: l # This should dump a list of the host principal, along with the encryption methods used to access the principal. # # Create an empty ACL file that can be modified later: # # touch /var/lib/krb5kdc/kadm5.acl # At this point, if everything has been successful so far, you can feel fairly confident in the installation and configuration of the package. if [[ ! -d "/opt/krb5-1.21.2" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_CONFIGURED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( krb5-1.21.2 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ------------------------------------------ tar -zxvf $STORAGE/krb5-1.21.2.tar.gz && STEP_UNZIPPED=1 # ------------------------------------------ # * Explain: sed -i -e '/eq 0/{N;s/12 //}' plugins/kdb/db2/libdb2/test/run.test: The sed command removes a test that is known to fail. # sed 命令删除已知失败的测试。 if [[ $STEP_UNZIPPED == 1 ]]; then sed -i -e '/eq 0/{N;s/12 //}' $STORAGE/krb5-1.21.2/src/plugins/kdb/db2/libdb2/test/run.test fi # ------------------------------------------ # * Default Configure Options: # ./configure --prefix=/usr \ # --sysconfdir=/etc \ # --localstatedir=/var/lib \ # --runstatedir=/run \ # --with-system-et \ # --with-system-ss \ # --with-system-verto=no \ # --enable-dns-for-realm # .......................................... # * Option: --with-system-et: This switch causes the build to use the system-installed versions of the error-table support software. # .......................................... # * Option: --with-system-ss: This switch causes the build to use the system-installed versions of the subsystem command-line interface software. # .......................................... # * Option: --with-system-verto=no: This switch fixes a bug in the package: it does not recognize its own verto library installed previously. # This is not a problem, if reinstalling the same version, but if you are updating, the old library is used as system's one, instead of installing the new version. # .......................................... # * Option: --enable-dns-for-realm: This switch allows realms to be resolved using the DNS server. # .......................................... # * Option: --with-ldap: Use this switch if you want to compile the OpenLDAP database backend module. cd $STORAGE/krb5-1.21.2/src && ./configure --prefix=/opt/krb5-1.21.2 \ --with-system-et \ --with-system-ss \ --with-system-verto=no \ --enable-dns-for-realm \ PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \ STEP_CONFIGURED=1 # ------------------------------------------ make && make install && STEP_INSTALLED=1 # ------------------------------------------ if [[ $STEP_INSTALLED == 1 ]]; then # Skip # if [[ ! -d "/usr/local/sbin" ]]; then mkdir /usr/local/sbin; fi # ...................................... if [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fi if [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi # ...................................... # Skip # ln -sf /opt/krb5-1.21.2/bin/* /usr/local/bin/ # ...................................... # Skip # ln -sf /opt/krb5-1.21.2/sbin/* /usr/local/sbin/ # ...................................... # Skip # rsync -av /opt/krb5-1.21.2/include/ /usr/local/include/ # Skip # rsync -av /opt/krb5-1.21.2/lib/ /usr/local/lib/ # ...................................... cp -f /opt/krb5-1.21.2/lib/pkgconfig/*.pc /opt/lib/pkgconfig/ fi # ------------------------------------------ # Now, as the root user: # cp -vfr ../doc -T /usr/share/doc/krb5-1.21.2 # .......................................... # Still as the root user, remove linker flags setting RPATH from the krb5-config script. # These flags are unneeded for an installation in the standard prefix (/usr) and they may cause some packages fail to build: # 仍然作为根用户, 从 krb5-config 配置脚本中删除设置 RPATH 的链接器标志。 # 这些标志对于标准前缀 (/usr) 中的安装是不需要的, 它们可能会导致某些包无法构建: # sed '/PROG_RPATH_FLAGS/d' -i /usr/bin/krb5-config # ------------------------------------------ cd $STORAGE && rm -rf $STORAGE/krb5-1.21.2 && return 0 else echo "[Caution] Path: ( /opt/krb5-1.21.2 ) Already Exists." # ------------------------------------------ return 0 fi } # Function: 编译安装(Compile Install) ICU-74.2 # ################################################## function Compile_Install_ICU_74_2() { # The International Components for Unicode (ICU) package is a mature, widely used set of C/C++ libraries providing Unicode and Globalization support for software applications. # ICU is widely portable and gives applications the same results on all platforms. # 国际 Unicode 组件 (ICU) 包是一组成熟、广泛使用的 C/C++ 库, 为软件应用程序提供Unicode和全球化支持。 # ICU具有广泛的便携性, 在所有平台上都能为应用程序提供相同的结果。 # .............................................. # Warning: # Upgrading this package to a new major version (for example, from 72.1 to 74.2) will require rebuilding of many other packages. # If some packages that use the libraries built by icu4c-74 are rebuilt, they will use the new libraries while current packages will use the previous libraries. # If the Linux application loader (/usr/lib/ld-linux-x86-64.so.2) determines that both the old and new libraries are needed, and a symbol (name of data or function) exists in both versions of the library, all references to the symbol will be resolved to the version appearing earlier in the breadth-first sequence of the dependency graph. # This may result in the application failing if the definition of the data or the behavior of the function referred by the symbol differs in two versions. # To avoid the issue, users will need to rebuild every package linked to an ICU library as soon as possible once ICU is updated to a new major version. # 警告: # 将此软件包升级到新的主要版本 (例如, 从 72.1 升级到 74.2) 将需要重建许多其他软件包。 # 如果重建了一些使用 icu4c-74 构建的库的包, 它们将使用新的库, 而当前包将使用以前的库。 # 如果 Linux 应用程序加载程序 (/usr/lib/ld-Linux-x86-64.so.2) 确定需要旧库和新库, 并且两个版本的库中都存在一个符号 (数据或函数的名称), 则对该符号的所有引用都将解析为依赖关系图的广度优先序列中较早出现的版本。 # 如果数据的定义或符号引用的函数的行为在两个版本中不同,这可能会导致应用程序失败。 # 为了避免这个问题, 一旦 ICU 更新到新的主要版本, 用户需要尽快重建链接到 ICU 库的每个包。 # .............................................. # To determine what external libraries are needed (directly or indirectly) by an application or a library, run: # 要确定应用程序或库 (直接或间接) 需要哪些外部库, 请运行: # ldd <application or library> # or to see only the directly needed libraries: # 或者只查看直接需要的库: # readelf -d <application or library> | grep NEEDED if [[ ! -d "/opt/icu-74.2" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_CONFIGURED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( icu-74.2 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ------------------------------------------ tar -zxvf $STORAGE/icu4c-74_2-src.tgz && STEP_UNZIPPED=1 # ------------------------------------------ cd $STORAGE/icu/source && ./configure --prefix=/opt/icu-74.2 && STEP_CONFIGURED=1 # ------------------------------------------ make && make install && STEP_INSTALLED=1 # ------------------------------------------ if [[ $STEP_INSTALLED == 1 ]]; then # Skip # if [[ ! -d "/usr/local/sbin" ]]; then mkdir /usr/local/sbin; fi # ...................................... if [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fi if [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi # ...................................... # Skip # ln -sf /opt/icu-74.2/bin/* /usr/local/bin/ # ...................................... # Skip # ln -sf /opt/icu-74.2/sbin/* /usr/local/sbin/ # ...................................... # Skip # rsync -av /opt/icu-74.2/include/ /usr/local/include/ # Skip # rsync -av /opt/icu-74.2/lib/ /usr/local/lib/ # ...................................... cp -f /opt/icu-74.2/lib/pkgconfig/icu-i18n.pc /opt/lib/pkgconfig/ cp -f /opt/icu-74.2/lib/pkgconfig/icu-io.pc /opt/lib/pkgconfig/ cp -f /opt/icu-74.2/lib/pkgconfig/icu-uc.pc /opt/lib/pkgconfig/ fi # ------------------------------------------ cd $STORAGE && rm -rf $STORAGE/icu && return 0 else echo "[Caution] Path: ( /opt/icu-74.2 ) Already Exists." # ------------------------------------------ return 0 fi } # Function: 编译安装(Compile Install) libusb-1.0.27 # ################################################## function Compile_Install_libusb_1_0_27() { # Configuring Libusb # To access raw USB devices (those not treated as a disk by the mass-storage driver), appropriate support must be available in the kernel. Check your kernel configuration: # # Device Drivers ---> # [*] USB support ---> [USB_SUPPORT] # <*/M> Support for Host-side USB [USB] # [*] PCI based USB host interface [USB_PCI] # # These are most common USB controller drivers for PC-like systems. # # For modern systems often [USB_XHCI_HCD] is the only one needed # # even if the system has USB 2.0 ports: # < /*/M> xHCI HCD (USB 3.0) support [USB_XHCI_HCD] # < /*/M> EHCI HCD (USB 2.0) support [USB_EHCI_HCD] # < /*/M> OHCI HCD (USB 1.1) support [USB_OHCI_HCD] # For more details on setting up USB devices, see the section called “USB Device Issues”. if [[ ! -d "/opt/libusb-1.0.27" ]]; then local VERIFY local STEP_UNZIPPED=0 local STEP_CONFIGURED=0 local STEP_INSTALLED=0 # ------------------------------------------ read -p "[Confirm] Compile and Install ( libusb-1.0.27 )? (y/n)>" VERIFY if [[ "$VERIFY" != "y" ]]; then exit 1; fi # ---------------------