add bootstrap.
This commit is contained in:
parent
297aec7910
commit
528279e3ae
|
@ -1,6 +1,11 @@
|
||||||
# Custom system config.
|
# 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.
|
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.
|
# Table of contents.
|
||||||
|
|
||||||
1. [General info.](#general-info)
|
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.
|
||||||
!/.README.md
|
!/.README.md
|
||||||
|
|
||||||
|
|
|
@ -2,38 +2,38 @@
|
||||||
# usage: tb [NAME]
|
# usage: tb [NAME]
|
||||||
tba()
|
tba()
|
||||||
{
|
{
|
||||||
local name="$1"
|
local name="${1}"
|
||||||
|
|
||||||
# set default name.
|
# set default name.
|
||||||
if [[ "$name" = "" ]]; then
|
if [[ "${name}" = "" ]]; then
|
||||||
name="main"
|
name="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# start container or run command inside it if specified.
|
# start container or run command inside it if specified.
|
||||||
if [[ "$2" = "" ]]; then
|
if [[ "${2}" = "" ]]; then
|
||||||
# set hostname.
|
# 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.
|
# try to enter or create if failed.
|
||||||
toolbox enter "$name" || {
|
toolbox enter "${name}" || {
|
||||||
# create container.
|
# create container.
|
||||||
toolbox create "$name"
|
toolbox create "${name}"
|
||||||
|
|
||||||
# initialize container.
|
# initialize container.
|
||||||
toolbox --container "$name" run sudo hostname "${HOSTNAME}-${name}"
|
toolbox --container "${name}" run sudo hostname "${HOSTNAME}-${name}"
|
||||||
toolbox --container "$name" run sudo rm /root/.bashrc
|
# 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 $HOME/.linux /root/.linux
|
||||||
toolbox --container "$name" run sudo ln -s /root/.linux/bash/bashrc.sh /root/.bashrc
|
# toolbox --container "$name" run sudo ln -s /root/.linux/bash/bashrc.sh /root/.bashrc
|
||||||
|
|
||||||
# enter container, finally.
|
# enter container, finally.
|
||||||
toolbox enter "$name"
|
toolbox enter "${name}"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# set hostname.
|
# set hostname.
|
||||||
toolbox --container "$name" run sudo hostname "${HOSTNAME}-${name}"
|
toolbox --container "${name}" run sudo hostname "${HOSTNAME}-${name}"
|
||||||
|
|
||||||
# run command inside container.
|
# run command inside container.
|
||||||
toolbox --container "$name" run ${@:2}
|
toolbox --container "${name}" run ${@:2}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,30 +41,30 @@ tba()
|
||||||
# usage: tbk [NAME]
|
# usage: tbk [NAME]
|
||||||
tbk()
|
tbk()
|
||||||
{
|
{
|
||||||
local name="$1"
|
local name="${1}"
|
||||||
|
|
||||||
# set default name.
|
# set default name.
|
||||||
if [[ "$name" = "" ]]; then
|
if [[ "${name}" = "" ]]; then
|
||||||
name="main"
|
name="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# stop and remove podman container.
|
# 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.
|
# install rpm-fusion repository.
|
||||||
# usage: tb_rpmfusion [NAME]
|
# usage: tb_rpmfusion [NAME]
|
||||||
tb_rpmfusion()
|
tb_rpmfusion()
|
||||||
{
|
{
|
||||||
local name="$1"
|
local name="${1}"
|
||||||
|
|
||||||
# set default name.
|
# set default name.
|
||||||
if [[ "$name" = "" ]]; then
|
if [[ "${name}" = "" ]]; then
|
||||||
name="main"
|
name="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run dnf inside container.
|
# 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.
|
# list all containers.
|
||||||
|
|
Reference in a new issue