#!/usr/bin/env bash # # beggar containerization assistant # # Copyright (C) 2017 Silvio Rhatto - rhatto at riseup.net # # 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 3 of the License, # or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Basic parameters VERSION="0.1.0" BASENAME="`basename $0`" DIRNAME="`dirname $0`" ACTION="$1" VM="$2" GLOBAL_USER_CONFIG_FOLDER="$HOME/.config/beggar" GLOBAL_USER_CONFIG_FILE="$HOME/.config/beggarconfig" function beggar_startup { mkdir -p $HOME/.config/lxc #mkdir -p $HOME/.local/share/{lxc,lxcsnaps} #mkdir -p $HOME/.cache/lxc #touch $HOME/.config/lxc/{lxc,default}.conf if [ ! -e "$HOME/.config/lxc/default.conf" ]; then echo \ "# Include system-wide settings lxc.include = /etc/lxc/default.conf # Subuids and subgids mapping $(cat /etc/subuid | grep $USER | sed -e "s/^$USER:/lxc.id_map = u 0 /" -e 's/:/ /') $(cat /etc/subgid | grep $USER | sed -e "s/^$USER:/lxc.id_map = g 0 /" -e 's/:/ /') # "Secure" mounting lxc.mount.auto = proc:mixed sys:ro cgroup:mixed # Network configuration lxc.network.type = veth lxc.network.link = lxcbr0 lxc.network.flags = up lxc.network.hwaddr = 00:FF:xx:xx:xx:xx" > $HOME/.config/lxc/default.conf fi } # Main beggar_startup