diff --git a/files/init/.bashrc b/files/init/.bashrc new file mode 100755 index 0000000..e5a3ac4 --- /dev/null +++ b/files/init/.bashrc @@ -0,0 +1,115 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + #alias grep='grep --color=auto' + #alias fgrep='fgrep --color=auto' + #alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +/root/stat.sh \ No newline at end of file diff --git a/files/init/00-root-allow.conf b/files/init/00-root-allow.conf new file mode 100644 index 0000000..5441b26 --- /dev/null +++ b/files/init/00-root-allow.conf @@ -0,0 +1 @@ +PermitRootLogin yes \ No newline at end of file diff --git a/files/init/00-update-issue.conf b/files/init/00-update-issue.conf new file mode 100644 index 0000000..f082b38 --- /dev/null +++ b/files/init/00-update-issue.conf @@ -0,0 +1 @@ + * * * * * root /root/update_issue.sh \ No newline at end of file diff --git a/files/init/htoprc b/files/init/htoprc new file mode 100755 index 0000000..74b2b6f --- /dev/null +++ b/files/init/htoprc @@ -0,0 +1,63 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +htop_version=3.2.2 +config_reader_min_version=3 +fields=0 48 17 18 38 39 40 2 46 47 49 1 +hide_kernel_threads=1 +hide_userland_threads=0 +hide_running_in_container=0 +shadow_other_users=0 +show_thread_names=0 +show_program_path=1 +highlight_base_name=0 +highlight_deleted_exe=1 +shadow_distribution_path_prefix=0 +highlight_megabytes=1 +highlight_threads=1 +highlight_changes=0 +highlight_changes_delay_secs=5 +find_comm_in_cmdline=1 +strip_exe_from_cmdline=1 +show_merged_command=0 +header_margin=1 +screen_tabs=1 +detailed_cpu_time=0 +cpu_count_from_one=0 +show_cpu_usage=1 +show_cpu_frequency=0 +show_cpu_temperature=0 +degree_fahrenheit=0 +update_process_names=0 +account_guest_in_cpu_meter=0 +color_scheme=0 +enable_mouse=1 +delay=15 +hide_function_bar=0 +header_layout=two_50_50 +column_meters_0=LeftCPUs Memory Hostname DateTime Battery +column_meter_modes_0=1 1 2 2 2 +column_meters_1=RightCPUs Swap Tasks LoadAverage Uptime +column_meter_modes_1=1 1 2 2 2 +tree_view=0 +sort_key=46 +tree_sort_key=0 +sort_direction=-1 +tree_sort_direction=1 +tree_view_always_by_pid=0 +all_branches_collapsed=0 +screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command +.sort_key=PERCENT_CPU +.tree_sort_key=PID +.tree_view=0 +.tree_view_always_by_pid=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 +screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command +.sort_key=IO_RATE +.tree_sort_key=PID +.tree_view=0 +.tree_view_always_by_pid=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 diff --git a/files/init/stat.sh b/files/init/stat.sh new file mode 100755 index 0000000..ac18000 --- /dev/null +++ b/files/init/stat.sh @@ -0,0 +1,31 @@ +EXT_IP=$(curl -s https://ipecho.net/plain) +echo +echo ===System Info============================================================================== +#uname -a | cut -d ")" -f 1 | tr -d '\n' && echo \) +uname -a | awk '{print $2 ": " $7 " " $8 " " $1 " " $10 " " $3 " Compiled " $9}' | tr -d "()" +uptime | cut -b 2- +echo +echo ===CPU Info================================================================================= +lscpu | grep "Model name" | grep -v BIOS | cut -d ":" -f 2 | awk '{$1=$1};1' | tr -d '\n' && \ +echo " - " | tr -d '\n' && \ +lscpu | grep "CPU(s):" | grep -v NUMA | rev | cut -b 1-4 | tr -d '\n' | tr -d ' ' | rev && echo ' cores' +echo +echo ===RAM Info================================================================================= +free -h +echo +echo ===Disk Info================================================================================ +df -h | grep Use\% +df -h | grep -v -e doc -e tmp -e eclipse -e udev -e efi -e Use\% -e 172.20 -e 172.25 -e ur | sort +df -h | grep 172.20 | grep -v eclipse | sort +df -h | grep 172.25 | grep -v eclipse | sort +echo +echo ===IP Info================================================================================== +ip -o -4 ad | grep -v -e docker -e 127.0.0.1 -e br- | awk '{print $2 "," $4}' | column -s , -t +netstat -tlpn | grep -v -e udp -e tcp6 | grep -c docker | tr -d '\n' && echo ' Docker Ports' +echo 'External IP: '$EXT_IP +echo +# /root/nvstat.sh + + + + diff --git a/files/init/update_issue.service b/files/init/update_issue.service new file mode 100755 index 0000000..d5e91e4 --- /dev/null +++ b/files/init/update_issue.service @@ -0,0 +1,10 @@ +[Unit] +Description=Update /etc/issue with ethN IP addresses +After=network-online.target + +[Service] +ExecStart=/root/update_issue.sh +Type=oneshot + +[Install] +WantedBy=multi-user.target diff --git a/files/init/update_issue.sh b/files/init/update_issue.sh new file mode 100755 index 0000000..2d1bd66 --- /dev/null +++ b/files/init/update_issue.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Retrieve IP addresses of interfaces +ip_addresses=$(ip -o -4 addr show | awk '(/eth|en|wl|wn|vmpbr0|tun/) {print $2 "," $4 "\r"}' | column -s , -t) +# Get OS Build Info +os_build=$(cat /etc/os-release | grep PRETTY | cut -d "\"" -f 2) +# Put hostname in a variable that probably isn't reserved or anything +host_name=$(hostname) + +# Write to /etc/issue +{ + echo $os_build + echo "Hostname: ${host_name}" + echo "IP Addresses:" + echo "$ip_addresses" + +} > /etc/issue diff --git a/templates/preseed-server-v2.cfg.j2 b/templates/preseed-server-v2.cfg.j2 index 11b6b4b..51af9ce 100755 --- a/templates/preseed-server-v2.cfg.j2 +++ b/templates/preseed-server-v2.cfg.j2 @@ -61,7 +61,7 @@ popularity-contest popularity-contest/participate boolean false # Package selection tasksel tasksel/first multiselect standard, ssh-server -d-i pkgsel/include string openssh-server curl openvpn net-tools htop +d-i pkgsel/include string openssh-server curl openvpn net-tools htop jq pigz sudo d-i pkgsel/upgrade select none d-i preseed/late_command string \ diff --git a/templates/preseed-usb.cfg.j2 b/templates/preseed-usb.cfg.j2 index e869c9a..b86dba8 100755 --- a/templates/preseed-usb.cfg.j2 +++ b/templates/preseed-usb.cfg.j2 @@ -71,7 +71,7 @@ popularity-contest popularity-contest/participate boolean false # Package selection tasksel tasksel/first multiselect standard, ssh-server -d-i pkgsel/include string openssh-server curl openvpn net-tools resolvconf htop +d-i pkgsel/include string openssh-server curl openvpn net-tools resolvconf htop jq pigz sudo d-i pkgsel/upgrade select none d-i preseed/late_command string \