Bash command for automatically confirm option during installation - bash

Whenever you're installing a package, it usually prompts for y/n confirmation, is there a way to automate this?

You might try
yes | install-package.sh

on debian based distros you can run:
apt-get -y install <package_to_install>
to further automate it (in case of installing packages that asks some questions - for example mysql-server asks for db root password) run:
DEBIAN_FRONTEND=noninteractive apt-get -y install <package_to_install>

Try the -f switch. It probably depends on which package manager you have, so you should check the man-page for your package manager to confirm.

Related

How to switch with SmartGit to non commercial version on Ubuntu 20.04

I use Ubuntu 20.04. After 30 days of using SmartGit, it wants to change to commercial version. I use it for personal purposes.
I tried this:
How to change SmartGit's licensing option after 30 days of commercial use on ubuntu?
and this:
https://www.syntevo.com/blog/?p=3669
but couldn't find such folders and files.
I also uninstalled and reinstalled it three times with these commands:
sudo apt remove smartgit
sudo apt autoclean && sudo apt autoremove
and
sudo apt install smartgit
but nothing changed.
So can anyone know a way how to change to non commercial version of SmartGit on Ubuntu 20.04?
Only applying "Delete the config files of SmartGit" part was enough for me.
So:
rm -rf ~/.config/smartgit
Then run smartgit and it asks for licensing options again like the first install.
Yes the other options for smartgit are lost removing the folder completely so a fine tuning may be done to this approach if needed.
Wow, I found the solution!
With the help of this:
https://askubuntu.com/questions/244754/how-to-completely-remove-application
So the process is
Remove SmartGit
sudo apt remove smartgit
sudo apt autoclean && sudo apt autoremove
Delete the config files of SmartGit
Navigate to the home directory,
Ctrl + H to show the hidden folders,
in the .config folder
delete the smartgit folder.
Install SmartGit
sudo apt install smartgit
Choose the free non-commercial option
Be careful. Choose not the default option but
the free non-commercial option.

FSL installation in Ubuntu FAILED message

I am a traditional Windows user and therefore you have to excuse me for my lack of experience with other OS. I installed Ubuntu in order to install FSL in my computer (seems the Windows installation failed so I tried this). However, the download goes right, but at the end it says "[FAILED] Unable to unpack FSL".
How can I solve it?
Thanks a lot
First of all, this is not a programming question. If it can still be moved to AskUbuntu (or SuperUser) it may be better appreciated.
In Ubuntu the easy way to install software is through the package manager. This is by far the least amount of work and installs binary packages in default locations (FSL is in the path straight away), plus it takes care of all the dependencies!
FSL is in the NeuroDebian repository, and if you add this to one of your 'software sources' then you can install it via Ubuntu's package manager, APT:
go to https://neuro.debian.net and find out how to add the right repository, e.g.
$ wget -O- http://neuro.debian.net/lists/focal.de-fzj.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
$ sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
update the list of packages APT can find:
$ sudo apt update
install the fsl packages you want, e.g.
$ sudo apt install fsl-5.0 fsl-harvard-oxford-cortical-lateralized-atlas

How to bypass the user confirmation when installing packages on linux

I'm writing a basic script in bash to automatically install a few packages on new machines (basically, the first script to run on a new machine before doing anything else). I'm downloading openssh-server and python for example.
My goal is just to launch the script in sudo mode, wait a few minutes and get started. The only problem I'm facing is the machine requires the user to input "y" when needed and I can't find a way to bypass this.
This is just a sample of my script :
#!/bin/bash
sudo apt update
sudo apt install openssh-server
sudo apt-get install python3
what I expect is just run this command and let it roll without the user to have and put "y" when needed
sudo bash start-script.sh
Use the -y option of apt-get. From the apt-get man page:
-y, --yes, --assume-yes
Automatic yes to prompts; assume "yes" as answer to all prompts and
run non-interactively. If an undesirable situation, such as
changing a held package, trying to install a unauthenticated
package or removing an essential package occurs then apt-get will
abort. Configuration Item: APT::Get::Assume-Yes.

Janus WebRTC installation issue

I am installing Janus WebRTC Gateway in a Ubuntu Machine (14.04 64 bit). I followed the instructions as in the following link:
However, I get the following error when trying to execute janus:
https://github.com/meetecho/janus-gateway (readme.md file)
[FATAL] [janus.c:main:3670] No Janus API transport is available...
enable at least one and restart Janus
Anyone has any idea what the issue might be? I will only use the REST API without WebStockets or RabbitMQ.
I successfully installed Janus on Ubuntu 14 according to the following steps:
sudo apt-get install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev libwebsockets-dev pkg-config gengetopt automake libtool doxygen graphviz git cmake
sudo apt-get install libavformat-dev
mkdir -p ~/build
cd ~/build
git clone git://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --disable-data-channels --disable-websockets --disable-rabbitmq --disable-docs --prefix=/opt/janus LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" CFLAGS="-I/usr/local/include"
make && sudo make install
sudo make configs
Running it by:
cd /opt/janus/bin/
./janus -F /opt/janus/etc/janus/
I had this issue before, I had write a script to install everything just run this
wget https://gist.githubusercontent.com/johnmelodyme/966f474a99b6dd0cf4e7ac19ba4258da/raw/0f1779499c62eeee3e2a577ef641e94e57b71154/janus.sh && sh janus.sh
Hope This Help Much, I believe there are certain dependencies needs to be installation but you missed it. In https://github.com/meetecho/janus-gateway it stated the Dependencies needed, have to be installed without error.
It is because libmicrohttpd version is lower than requirement, Download and install libmicrohttpd manually (dont use yum or apt-get).

apt-get not working in Cygwin

I'm something of a Cygwin newbie, so that might be the problem, but I'm trying to install a package using apt-get and it's telling me there's no such command. I installed it on Windows 7.
The best I got from searching other questions here and across the net was that you need to install something specific (or run the setup file to update) when initially installing, but it's not clear to me what I need to install or run or whatever.
How do I install or update my cygwin to be able to use apt-get or, alternatively, how would I install packages with the basic, default installation of Cygwin that I already have?
Thank you.
You can use this : apt-cyg
It works just like apt-get in terms of command line arguments, but you will be using apt-cyg instead.
Refer https://github.com/transcode-open/apt-cyg It did helped me.
To install apt-cyg package.
Cygwin's official installer is setup.exe. This is the "proper" way to install Cygwin packages. There's a project called cyg-apt but it's not officially part of Cygwin.

Resources