add bash ui when load and install neofetch
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
# .bash_profile
|
||||||
|
|
||||||
|
# Get the aliases and functions
|
||||||
|
if [ -f ~/.bashrc ]; then
|
||||||
|
. ~/.bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# User specific environment and startup programs
|
||||||
|
|
||||||
|
PATH=$PATH:$HOME/bin
|
||||||
|
|
||||||
|
export PATH
|
||||||
|
unset USERNAME
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
alias update='apk update && apk upgrade'
|
||||||
|
|
||||||
|
export HISTTIMEFORMAT="%d/%m/%y %T "
|
||||||
|
export PS1='\u@\h:\W \$ '
|
||||||
|
|
||||||
|
alias l='ls -CF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
|
source /etc/profile.d/bash_completion.sh
|
||||||
|
|
||||||
|
export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ "
|
||||||
|
##############################################################################################################################
|
||||||
|
# Borg Repo finder
|
||||||
|
##############################################################################################################################
|
||||||
|
function sepurator {
|
||||||
|
echo "==============================================================================="
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_borg_repo {
|
||||||
|
repo_list=( $(find "$1" -name "index.*" -type f | rev | cut -d '/' -f "2-" | rev) )
|
||||||
|
|
||||||
|
if [ -z "$repo_list" ]; then
|
||||||
|
echo "* Can not find borg repository"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
sepurator
|
||||||
|
echo "* Select borg repository"
|
||||||
|
sepurator
|
||||||
|
select_borg_repo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function select_borg_repo {
|
||||||
|
if [ "${#repo_list[@]}" -eq 1 ]; then
|
||||||
|
echo "* Only one item"
|
||||||
|
sepurator
|
||||||
|
selected_repo="0"
|
||||||
|
else
|
||||||
|
for key in "${!repo_list[@]}" ; do
|
||||||
|
echo "$key: ${repo_list[key]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
selected_repo=asfd
|
||||||
|
while ! [[ $selected_repo -lt ${#repo_list[@]} && $selected_repo =~ ^[+]?[0-9]+$ ]]; do
|
||||||
|
read -p "Please select a Repo: " selected_repo
|
||||||
|
|
||||||
|
if [[ $selected_repo -gt $((${#repo_list[@]} -1)) ]]; then
|
||||||
|
sepurator
|
||||||
|
echo "* Oops! User input was out of range!"
|
||||||
|
sepurator
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ $selected_repo =~ ^[+]?[0-9]+$ ]]; then
|
||||||
|
sepurator
|
||||||
|
echo "* Oops! User input was not a positive integer!"
|
||||||
|
sepurator
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_borg_repo backups/
|
||||||
|
export BORG_REPO="${repo_list[selected_repo]}"
|
||||||
|
clear
|
||||||
|
neofetch
|
||||||
@@ -2,3 +2,4 @@ sshkeys/clients/
|
|||||||
sshkeys/host/
|
sshkeys/host/
|
||||||
crontab.txt
|
crontab.txt
|
||||||
maintain_repo.sh
|
maintain_repo.sh
|
||||||
|
backups/
|
||||||
|
|||||||
+4
-1
@@ -15,9 +15,12 @@ VOLUME ["/sshkeys/host"]
|
|||||||
COPY motd.txt /etc/motd
|
COPY motd.txt /etc/motd
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
|
||||||
|
COPY .bash_profile /root/
|
||||||
|
COPY .bashrc /root/
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
RUN apk update ; apk upgrade
|
RUN apk update ; apk upgrade
|
||||||
RUN apk add --no-cache sudo bash tzdata openssh-server openrc \
|
RUN apk add --no-cache sudo bash bash-completion tzdata openssh-server openrc neofetch \
|
||||||
borgbackup
|
borgbackup
|
||||||
RUN rm -rf /var/cache/apk/*
|
RUN rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function add_borg_user {
|
|||||||
if ! id "borg" &>/dev/null; then
|
if ! id "borg" &>/dev/null; then
|
||||||
sh -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
sh -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
||||||
adduser \
|
adduser \
|
||||||
|
-s /bin/bash \
|
||||||
--disabled-password \
|
--disabled-password \
|
||||||
--gecos "" \
|
--gecos "" \
|
||||||
--home "/" \
|
--home "/" \
|
||||||
|
|||||||
Reference in New Issue
Block a user