add bootstrap.
This commit is contained in:
parent
297aec7910
commit
528279e3ae
|
@ -1,6 +1,11 @@
|
|||
# Custom system config.
|
||||
This is my own custom config that I use on my GNU/Linux machines. Not ment to be used by anyone else.
|
||||
|
||||
# Bootstrap.
|
||||
```bash
|
||||
|
||||
```
|
||||
|
||||
# Table of contents.
|
||||
|
||||
1. [General info.](#general-info)
|
||||
|
|
14
.bootstrap.sh
Executable file
14
.bootstrap.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# check if this is already a git repo.
|
||||
if [[ -d ".git" ]]; then
|
||||
echo "Found the .git directory. Already initialized?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# sync.
|
||||
git init
|
||||
git remote add origin https://git.voronind.com/voronind/linux.git
|
||||
git fetch
|
||||
git reset origin/master
|
||||
git checkout -t origin/master
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,8 @@
|
|||
*
|
||||
|
||||
# bootstrap.
|
||||
!/.bootstrap.sh
|
||||
|
||||
# readme.
|
||||
!/.README.md
|
||||
|
||||
|
|
|
@ -2,38 +2,38 @@
|
|||
# usage: tb [NAME]
|
||||
tba()
|
||||
{
|
||||
local name="$1"
|
||||
local name="${1}"
|
||||
|
||||
# set default name.
|
||||
if [[ "$name" = "" ]]; then
|
||||
if [[ "${name}" = "" ]]; then
|
||||
name="main"
|
||||
fi
|
||||
|
||||
# start container or run command inside it if specified.
|
||||
if [[ "$2" = "" ]]; then
|
||||
if [[ "${2}" = "" ]]; then
|
||||
# set hostname.
|
||||
toolbox --container "$name" run sudo hostname "${HOSTNAME}-${name}"
|
||||
toolbox --container "${name}" run sudo hostname "${HOSTNAME}-${name}"
|
||||
|
||||
# try to enter or create if failed.
|
||||
toolbox enter "$name" || {
|
||||
toolbox enter "${name}" || {
|
||||
# create container.
|
||||
toolbox create "$name"
|
||||
toolbox create "${name}"
|
||||
|
||||
# initialize container.
|
||||
toolbox --container "$name" run sudo hostname "${HOSTNAME}-${name}"
|
||||
toolbox --container "$name" run sudo rm /root/.bashrc
|
||||
toolbox --container "$name" run sudo ln -s $HOME/.linux /root/.linux
|
||||
toolbox --container "$name" run sudo ln -s /root/.linux/bash/bashrc.sh /root/.bashrc
|
||||
toolbox --container "${name}" run sudo hostname "${HOSTNAME}-${name}"
|
||||
# toolbox --container "$name" run sudo rm /root/.bashrc
|
||||
# toolbox --container "$name" run sudo ln -s $HOME/.linux /root/.linux
|
||||
# toolbox --container "$name" run sudo ln -s /root/.linux/bash/bashrc.sh /root/.bashrc
|
||||
|
||||
# enter container, finally.
|
||||
toolbox enter "$name"
|
||||
toolbox enter "${name}"
|
||||
}
|
||||
else
|
||||
# set hostname.
|
||||
toolbox --container "$name" run sudo hostname "${HOSTNAME}-${name}"
|
||||
toolbox --container "${name}" run sudo hostname "${HOSTNAME}-${name}"
|
||||
|
||||
# run command inside container.
|
||||
toolbox --container "$name" run ${@:2}
|
||||
toolbox --container "${name}" run ${@:2}
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -41,30 +41,30 @@ tba()
|
|||
# usage: tbk [NAME]
|
||||
tbk()
|
||||
{
|
||||
local name="$1"
|
||||
local name="${1}"
|
||||
|
||||
# set default name.
|
||||
if [[ "$name" = "" ]]; then
|
||||
if [[ "${name}" = "" ]]; then
|
||||
name="main"
|
||||
fi
|
||||
|
||||
# stop and remove podman container.
|
||||
podman stop "$name" > /dev/null && podman rm "$name" > /dev/null
|
||||
podman stop "${name}" > /dev/null && podman rm "${name}" > /dev/null
|
||||
}
|
||||
|
||||
# install rpm-fusion repository.
|
||||
# usage: tb_rpmfusion [NAME]
|
||||
tb_rpmfusion()
|
||||
{
|
||||
local name="$1"
|
||||
local name="${1}"
|
||||
|
||||
# set default name.
|
||||
if [[ "$name" = "" ]]; then
|
||||
if [[ "${name}" = "" ]]; then
|
||||
name="main"
|
||||
fi
|
||||
|
||||
# run dnf inside container.
|
||||
toolbox --container "$name" run sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
toolbox --container "${name}" run sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||
}
|
||||
|
||||
# list all containers.
|
||||
|
|
Reference in a new issue