Desktop scripts
This commit is contained in:
parent
6079f98037
commit
639e4dbf2d
19 changed files with 321 additions and 0 deletions
48
scripts/create_container
Executable file
48
scripts/create_container
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
# Debian containers only
|
||||
function create_container {
|
||||
echo -n "Enter the path of the container (including container root): "
|
||||
read -e CONTAINER_PATH
|
||||
|
||||
echo -n "Enter debian release channel: "
|
||||
read CHANNEL
|
||||
|
||||
echo -n "Enter (private) ssh key for git (absolute path): "
|
||||
read -e KEY
|
||||
|
||||
echo "Creating container.."
|
||||
debootstrap $CHANNEL $CONTAINER_PATH
|
||||
mkdir $CONTAINER_PATH/root/.bin/
|
||||
|
||||
echo "Copying key.."
|
||||
mkdir $CONTAINER_PATH/root/.ssh
|
||||
cp $KEY $KEY.pub $CONTAINER_PATH/root/.ssh/
|
||||
|
||||
echo -n "Start a ssh server? [y/n]: "
|
||||
read SSH_SERVER
|
||||
|
||||
if [ "$SSH_SERVER" == "y" ] ;then
|
||||
systemd-nspawn -D $CONTAINER_PATH apt-get install ssh
|
||||
add_ssh $CONTAINER_PATH
|
||||
elif [ -z "$SSH_SERVER" ] ;then
|
||||
echo "Not creating a ssh server"
|
||||
fi
|
||||
|
||||
echo "Installing vim & git"
|
||||
systemd-nspawn -D $CONTAINER_PATH apt-get install vim git
|
||||
|
||||
echo "Starting container first time, enter root pass"
|
||||
systemd-nspawn -D $CONTAINER_PATH passwd
|
||||
}
|
||||
|
||||
function add_ssh {
|
||||
echo -n "Enter ssh listening port: "
|
||||
read PORT
|
||||
|
||||
echo "Editing ssh config"
|
||||
# edit ssh config
|
||||
sed -i 's/^#Port .*/Port '"$PORT"'/' $1/etc/ssh/sshd_config
|
||||
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $1/etc/ssh/sshd_config
|
||||
}
|
||||
|
||||
create_container
|
||||
Loading…
Add table
Add a link
Reference in a new issue