Commit 1cd6d1f5 authored by brucekomike's avatar brucekomike
Browse files

ssh setup for ubuntu server

parent 8aec9bd9
No related merge requests found
Showing with 99 additions and 20 deletions
+99 -20
#!/bin/bash
if [ "$EUID" -ne 0 ]
then
echo "this script must be executed with root permission"
exit 1
fi
## os check
if ! grep -q 'Ubuntu' /etc/os-release
then
echo "This script should be run in Ubuntu"
exit 1
fi
## env var check
if ! [ -z ${SCRIPT_DIR:+x} ]
then
echo "No \$SCRIPT_DIR presentlsed"
exit 1
fi
cat $SCRIPT_DIR/share/bash-ps1-temp >> ~/.bashrc
\ No newline at end of file
source ./env-check-linux.sh
env-check-root 'Ubuntu'
apt_install="apt install -y --fix-missing --install-recommends --install-suggests"
## packages
function install-apt-packages(){
APT_PACKAGES=""
PYTHON3_PACKAGES="python3 python3-pip python3-dev lib32z1 "
RUBY_PACKAGES="ruby ruby-dev "
BASIC_PACKAGES="git curl wget vim tmux zsh net-tools iputils-ping openssh-server openssh-client locales "
DEV_PACKAGES="gcc gdb gdbserver g++ libssl-dev libffi-dev build-essential gdb-multiarch "
DEBUG_PACKAGES="bison cpio "
QEMU_PACKAGES="autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \
git tmux python3 python3-pip ninja-build"
#xinetd curl gcc gdb gdbserver g++ git libssl-dev libffi-dev build-essential \
#iputils-ping cpio gdb-multiarch file net-tools socat ruby ruby-dev locales \
#autoconf automake libtool make zsh openssh-server openssh-client ipython3 \
#gdb-multiarch bison wget
SELECTED_PACKAGES=$(dialog --checklist "Select apt packages to install:" 0 0 10 \
"PYTHON3_PACKAGES" "Python3 packages" on \
"RUBY_PACKAGES" "ruby ruby-dev etc." off \
"BASIC_PACKAGES" "packages for basic system setup" on \
"DEV_PACKAGES" "packages for basic development" on \
"DEBUG_PACKAGES" "packages debuging purpose" off \
"QEMU_PACKAGES" "Handy collected QEMU requirements" off \
3>&1 1>&2 2>&3 3>&-)
# Convert selected package names to their values
apt update
for package in $SELECTED_PACKAGES
do
echo $package
eval "APT_PACKAGES+=\"${!package}\""
done
if [[ -n "$APT_PACKAGES" ]]; then
$apt_install $APT_PACKAGES
else
echo "No packages selected"
fi
}
function installing-git-packages(){
mkdir ~/Workspace
cd ~/Workspace
wget https://download.qemu.org/qemu-7.0.0.tar.xz
tar xvJf qemu-7.0.0.tar.xz
cd qemu-7.0.0
./configure --target-list=riscv64-softmmu,riscv64-linux-user
make -j$(nproc)
}
function install-git-packages(){
sudo-as-user "$(get-user-input "user name to install git packages")" "installing-git-packages"
}
#qemu-git
function setup-shell-prompt(){
echo "export PATH=$PATH:~/Workspace/qemu-7.0.0/build" >> ~/.bashrc
}
function system-upgrade(){
apt update
apt upgrade
}
function setup-ssh(){
echo "Setting up SSH"
curl $(get-user-input "enter the public keys URL") | sudo-as-user "$(get-user-input "user name to install git packages")" "mkdir ~/.ssh; tee ~/.ssh/authorized_keys"
function main(){
SELECTED_OPERATION=$(dialog --checklist "Select operation to perform:" 0 0 0 \
"install-apt-packages" "Install regular apt Packages" on \
"install-git-packages" "Install selected Packages from git " off \
"setup-shell-prompt" "Setup Shell Prompt" on \
"system-upgrade" "do a (nearly) full system update" on \
3>&1 1>&2 2>&3 3>&-)
if [ -z "$SELECTED_OPERATION" ]; then
echo "No operation selected"
else
for operation in $SELECTED_OPERATION
do
eval "$operation"
done
fi
}
check-package 'dialog' "$apt_install"
check-package 'git' "$apt_install"
main
Subproject commit 71a6ac8ce8b2dad4507c9dc71f00ae44cfe2e44f
Subproject commit 06220f9d73feaee1fd6e035ce727ee12bcad654d
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment