Dear FreeBSD Gurus!
Please share bash script to automate installing bunch of packages without any user interaction in a process.
Let me write a little bit of details what I need exactly:
pkg_autoinstaller_list.txt - text file that contain name of packages that I would to install. Each name in separate row. Full name of package (“zsh-5.2.4”), or short version (“zsh”), case-sensitive.
Looks like this below:
—
zsh
zsh-highlighting
py38-speedtest-cli
librespeed
fping
bpytop
webmin
...
—
pkg-autoinstaller.sh - bash script that I asking for.
pkg_autoinstaller_mmddyyyy_hhmmss.log - log file, that also contain copy of screen output of each pkg installation process for review later.
Name of the file contain data&time of creation.
Each string of log with time stamp.
Summary with Start time and End time, number of possible errors/warnings during the process at the start of this log file, looks like this:
—
Installations summary:
TOTAL packages to install 54
EXIST IN REPO 54
ABORTED 1
SUCCESSFULLY INSTALLED 53
WARNINGS 2
REBOOT REQUIRED
TOTAL packages to install - calculated from pkg_to_install.txt.
EXIST IN REPO - calculated from pkg_to_install.txt that successfully founded in pkg repo.
ABORTED - calculated if in output words “error”, “aborted”, case-sensitive
SUCCESSFULLY INSTALLED = EXIST IN REPO - ABORTED
WARNINGS - calculated if in output word “warning”, case-sensitive
REBOOT REQUIRED - persist if in output word “reboot”, case-sensitive
Script parameters:
-fpkg #force update pkg system
-f #force reinstall package even installed already
-c #ignore case-sensitivity when search in pkg repo
-e #not open log-file in default system editor at the end of installation
-rst #restart system after installation complete if no errors (mean no “Error”, “Failed” in every package from list)
-s #play short beeps (if possible by system mb beeper) on complete after log-file was opened in editor successfully.
Logic: (you may correct or add something):
- clean pkg system cache
- update pkg system before installation
- check/reserve 300kb space for log file
- read each package name from pkg_to_install.txt, install it, write screen output to pkg_autoinstaller.log log file
- [OPT] open log file in editor on tty0 (or where from script started), play short beeps to get attention
- [OPT] standard restart server
Thanks you all another one time!
P.S. I more that sure that this is trivial script, that may be exist in Your scripts library...
I still thinking it very useful for SysAdmins that installing BSD frequently.
Please share bash script to automate installing bunch of packages without any user interaction in a process.
Let me write a little bit of details what I need exactly:
pkg_autoinstaller_list.txt - text file that contain name of packages that I would to install. Each name in separate row. Full name of package (“zsh-5.2.4”), or short version (“zsh”), case-sensitive.
Looks like this below:
—
zsh
zsh-highlighting
py38-speedtest-cli
librespeed
fping
bpytop
webmin
...
—
pkg-autoinstaller.sh - bash script that I asking for.
pkg_autoinstaller_mmddyyyy_hhmmss.log - log file, that also contain copy of screen output of each pkg installation process for review later.
Name of the file contain data&time of creation.
Each string of log with time stamp.
Summary with Start time and End time, number of possible errors/warnings during the process at the start of this log file, looks like this:
—
Installations summary:
TOTAL packages to install 54
EXIST IN REPO 54
ABORTED 1
SUCCESSFULLY INSTALLED 53
WARNINGS 2
REBOOT REQUIRED
TOTAL packages to install - calculated from pkg_to_install.txt.
EXIST IN REPO - calculated from pkg_to_install.txt that successfully founded in pkg repo.
ABORTED - calculated if in output words “error”, “aborted”, case-sensitive
SUCCESSFULLY INSTALLED = EXIST IN REPO - ABORTED
WARNINGS - calculated if in output word “warning”, case-sensitive
REBOOT REQUIRED - persist if in output word “reboot”, case-sensitive
Script parameters:
-fpkg #force update pkg system
-f #force reinstall package even installed already
-c #ignore case-sensitivity when search in pkg repo
-e #not open log-file in default system editor at the end of installation
-rst #restart system after installation complete if no errors (mean no “Error”, “Failed” in every package from list)
-s #play short beeps (if possible by system mb beeper) on complete after log-file was opened in editor successfully.
Logic: (you may correct or add something):
- clean pkg system cache
- update pkg system before installation
- check/reserve 300kb space for log file
- read each package name from pkg_to_install.txt, install it, write screen output to pkg_autoinstaller.log log file
- [OPT] open log file in editor on tty0 (or where from script started), play short beeps to get attention
- [OPT] standard restart server
Thanks you all another one time!
P.S. I more that sure that this is trivial script, that may be exist in Your scripts library...
Last edited: