#!/bin/bash -e################################################################################# Copyright (C) 2014 - 2018 by osrc <www.osrc.cn>## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## Asking for Help:# Nathan Rossi <nathan.rossi@xilinx.com># Michal Simek <michal.simek@xilinx.com>## Reference Materials:################################################################################# => Writing a Warning Message to the Console Windowprint_warn() { # 黄色字local msg="1ドル"printf "0円33[33m[WARNING] 0円33[0m";printf "$msg\n";}export -f print_warn# => Writing a Infomation Message to the Console Windowprint_info() { # 绿色字local msg="1ドル"printf "0円33[32m[INFO] 0円33[0m";printf "$msg\n";}export -f print_info# => Writing a Error Message to the Console Windowprint_error() { # 红色字local msg="1ドル"printf "0円33[31m[ERROR] 0円33[0m";printf "$msg\n";}export -f print_error# => Writing a Error Message to the Console Window and exiterror_exit() { # 红色字local msg="1ドル"printf "0円33[31m[ERROR] 0円33[0m";printf "$msg\n";exit 1;}export -f error_exit# => Check the script is being run by root usercheck_root() {if [ `whoami` != root ]; thenerror_exit "0ドル must be run as sudo user or root!"fi}export -f check_root# => When the current user isn't root, re-exec the script through sudo.run_as_root() {[ "$(whoami)" != "root" ] && exec sudo -- "0ドル" "$@"}export -f run_as_root# => This function will return the code name of the Linux host release to the callerget_host_type() {local __host_type=1ドルlocal the_host=`lsb_release -a 2>/dev/null | grep Codename: | awk {'print 2ドル'}`eval $__host_type="'$the_host'"}export -f get_host_type# => This function returns the version of the Linux host to the callerget_host_version() {local __host_ver=1ドルlocal the_version=`lsb_release -a 2>/dev/null | grep Release: | awk {'print 2ドル'}`eval $__host_ver="'$the_version'"}export -f get_host_version# => This function returns the major version of the Linux host to the caller# If the host is version 12.04 then this function will return 12get_major_host_version() {local __host_ver=1ドルget_host_version major_versioneval $__host_ver="'${major_version%%.*}'"}export -f get_major_host_version# => This function returns the minor version of the Linux host to the caller# If the host is version 12.04 then this function will return 04get_minor_host_version() {local __host_ver=1ドルget_host_version minor_versioneval $__host_ver="'${minor_version##*.}'"}export -f get_minor_host_version# => apt-get wrapper to just get arguments set correctlyfunction apt-get() {local sudo="sudo"[ "$(id -u)" = "0" ] && sudo=""$sudo DEBIAN_FRONTEND=noninteractive apt-get \--optin "Dpkg::Options::=--force-confold" --assume-yes "$@"}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。