Merge branch 'master' of https://git.oopen.de/script/admin-stuff
This commit is contained in:
commit
6c91fc0987
191
add_new_user.sh
Executable file
191
add_new_user.sh
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]] ; then
|
||||||
|
echo ""
|
||||||
|
echo " No username given on comand line."
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
user_name=$1
|
||||||
|
#password=$2
|
||||||
|
#password=${password:="test100"}
|
||||||
|
|
||||||
|
if [[ -z "$2" ]]; then
|
||||||
|
password_needed=true
|
||||||
|
password="test100"
|
||||||
|
else
|
||||||
|
password_needed=false
|
||||||
|
password=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
replace_files=".bashrc .bash_logout .profile .vimrc"
|
||||||
|
|
||||||
|
templates_base_dir="${working_dir}/supported-files/user_templates"
|
||||||
|
templates_all_dir="${templates_base_dir}/all"
|
||||||
|
|
||||||
|
if [[ -f "/etc/adduser.conf" ]]; then
|
||||||
|
. /etc/adduser.conf
|
||||||
|
home_base_dir="$DHOME"
|
||||||
|
min_uid=$FIRST_UID
|
||||||
|
skel_dir="$SKEL"
|
||||||
|
else
|
||||||
|
home_base_dir=/home
|
||||||
|
min_uid=1000
|
||||||
|
skel_dir=/etc/skel
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# - Create user if not exists
|
||||||
|
# -
|
||||||
|
if ! id -u "${user_name}" > /dev/null 2>&1 ; then
|
||||||
|
|
||||||
|
# - Get uid/gid
|
||||||
|
# -
|
||||||
|
if [[ "$user_name" = 'sysadm' ]]; then
|
||||||
|
user_uid=1050
|
||||||
|
user_gid=1050
|
||||||
|
elif [[ "$user_name" = 'back' ]]; then
|
||||||
|
user_uid=1060
|
||||||
|
user_gid=1060
|
||||||
|
else
|
||||||
|
|
||||||
|
declare -i _id=$(expr $min_uid - 1)
|
||||||
|
|
||||||
|
while true ; do
|
||||||
|
((_id++))
|
||||||
|
$(id $_id > /dev/null 2>&1) && continue
|
||||||
|
$(cat /etc/group | cut -d ':' -f3 | grep -q $_id 2> /dev/null) && continue
|
||||||
|
break
|
||||||
|
done
|
||||||
|
user_uid=$_id
|
||||||
|
user_gid=$_id
|
||||||
|
fi
|
||||||
|
|
||||||
|
# - Add user to system
|
||||||
|
# -
|
||||||
|
echo "$user_name:${password}:${user_uid}:${user_gid}:${user_name},,,:${home_base_dir}/${user_name}:/bin/bash" | newusers
|
||||||
|
|
||||||
|
if [[ -d "$skel_dir" ]]; then
|
||||||
|
cp -a "${skel_dir}/.bash_logout" "${home_base_dir}/${user_name}/"
|
||||||
|
chown ${user_name}:${user_name} "${home_base_dir}/${user_name}/.bash_logout"
|
||||||
|
|
||||||
|
cp -a "${skel_dir}/.bashrc" "${home_base_dir}/${user_name}/"
|
||||||
|
chown ${user_name}:${user_name} "${home_base_dir}/${user_name}/.bashrc"
|
||||||
|
|
||||||
|
cp -a "${skel_dir}/.profile" "${home_base_dir}/${user_name}/"
|
||||||
|
chown ${user_name}:${user_name} "${home_base_dir}/${user_name}/.profile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
user_uid=$(id -u ${user_name})
|
||||||
|
user_gid=$(id -g ${user_name})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# - Set new password
|
||||||
|
# -
|
||||||
|
if $password_needed ; then
|
||||||
|
|
||||||
|
# - sysadm
|
||||||
|
# -
|
||||||
|
if [[ "$user_name" = 'sysadm' ]]; then
|
||||||
|
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$vvccwrTc\\\$Sz1HaSb3ujObprltiG7D6U1Rr3fpgfjkKuDDWYdHzPkPx/0pEofCWC.vyTn78hcemkntl.6wVUOnJnNloKt/E/:\2#" /etc/shadow
|
||||||
|
|
||||||
|
# - chris
|
||||||
|
# -
|
||||||
|
elif [[ "$user_name" = 'chris' ]]; then
|
||||||
|
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$eS5Z/MP3\\\$9L5nW7lUSgKI2Sxe4tQGZYQHhndLnKh6ysOuxvQ6YGT7Q6IXihscvw.sVareOHohwjbLDbbAXHK0FWOEQYH2e1:\2#" /etc/shadow
|
||||||
|
|
||||||
|
# - root
|
||||||
|
# -
|
||||||
|
elif [[ "$user_name" = 'root' ]]; then
|
||||||
|
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$shJF/I7l\\\$Z9H3on8zNLS3AxR3TtYU1lmMW7sHnpn9ylW2.758uOIDBl0Sku2x7xYfml8ty0JJrhZMXLrGnikprqqtmgAoq1:\2#" /etc/shadow
|
||||||
|
|
||||||
|
# - Other normal users (uid > $min_uid)
|
||||||
|
# -
|
||||||
|
elif [[ $user_uid -ge $min_uid ]] ; then
|
||||||
|
perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$R6DYYcau\\\$TZYgG122V1oDl1wddNb8ieQIUMab35xItyFlnlStkEBV3DS5S6x7co6S/FpwbHzX21c1HF3WCUQ5/5s.umi6I.:\2#" /etc/shadow
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
home_dir="$(cat /etc/passwd | grep -E "^${user_name}:" | cut -d':' -f6)"
|
||||||
|
|
||||||
|
|
||||||
|
# - Backup existing files befor replacing them..
|
||||||
|
# -
|
||||||
|
if [[ -f "${home_dir}/.bashrc" ]] && [[ ! -f "${home_dir}/.bashrc.ORIG" ]]; then
|
||||||
|
mv "${home_dir}/.bashrc" "${home_dir}/.bashrc.ORIG"
|
||||||
|
fi
|
||||||
|
if [[ -f "${home_dir}/.profile" ]] && [[ ! -f "${home_dir}/.profile.ORIG" ]] ; then
|
||||||
|
mv "${home_dir}/.profile" "${home_dir}/.profile.ORIG"
|
||||||
|
fi
|
||||||
|
if [[ -f "${home_dir}/.bash_logout" ]] && [[ ! -f "${home_dir}/.bash_logout.ORIG" ]] ; then
|
||||||
|
mv "${home_dir}/.bash_logout" "${home_dir}/.bash_logout.ORIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# - Replace/Add files
|
||||||
|
# -
|
||||||
|
for _file in $replace_files ; do
|
||||||
|
if [[ -f "${templates_base_dir}/${user_name}/${_file}" ]] ; then
|
||||||
|
cp -a "${templates_base_dir}/${user_name}/${_file}" "${home_dir}/"
|
||||||
|
chown ${user_name}:${user_name} "${home_dir}/${_file}"
|
||||||
|
elif [[ -f "${templates_all_dir}/${_file}" ]]; then
|
||||||
|
cp -a "${templates_all_dir}/${_file}" "${home_dir}/"
|
||||||
|
chown ${user_name}:${user_name} "${home_dir}/${_file}"
|
||||||
|
else
|
||||||
|
if [[ -f "${home_dir}/${_file}.ORIG" ]]; then
|
||||||
|
mv "${home_dir}/${_file}.ORIG" "${home_dir}/${_file}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -d "${home_dir}/.ssh" ]]; then
|
||||||
|
cp -a "${home_dir}/.ssh" "${home_dir}/.ssh.BAK"
|
||||||
|
else
|
||||||
|
mkdir "${home_dir}/.ssh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh_auhtorized_file=""
|
||||||
|
if [[ -d "${templates_base_dir}/${user_name}/.ssh" ]]; then
|
||||||
|
if [[ -f "${templates_base_dir}/${user_name}/.ssh/authorized_keys2" ]]; then
|
||||||
|
ssh_auhtorized_file="${templates_base_dir}/${user_name}/.ssh/authorized_keys2"
|
||||||
|
elif [[ -f "${templates_base_dir}/${user_name}/.ssh/authorized_keys" ]]; then
|
||||||
|
ssh_auhtorized_file="${templates_base_dir}/${user_name}/.ssh/authorized_keys"
|
||||||
|
fi
|
||||||
|
elif [[ -d "${templates_all_dir}/.ssh" ]] ; then
|
||||||
|
if [[ -f "${templates_all_dir}/.ssh/authorized_keys2" ]]; then
|
||||||
|
ssh_auhtorized_file="${templates_all_dir}/.ssh/authorized_keys2"
|
||||||
|
elif [[ -f "${templates_all_dir}/.ssh/authorized_keys" ]]; then
|
||||||
|
ssh_auhtorized_file="${templates_all_dir}/.ssh/authorized_keys"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -n "$ssh_auhtorized_file" ]] ; then
|
||||||
|
cp -a "$ssh_auhtorized_file" "${home_dir}/.ssh/"
|
||||||
|
elif [[ -d "${home_dir}/.ssh.BAK" ]] ; then
|
||||||
|
rm -rf "${home_dir}/.ssh.BAK"
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 700 ${home_dir}/.ssh
|
||||||
|
chown -R ${user_name}:${user_name} ${home_dir}/.ssh
|
||||||
|
|
||||||
|
if [[ "$user_name" = 'sysadm' ]] || [[ "$user_name" = 'chris' ]] ; then
|
||||||
|
usermod -a -G sudo ${user_name}
|
||||||
|
fi
|
||||||
|
#ls -al ${home_dir}/.ssh
|
||||||
|
echo ""
|
||||||
|
echo -e " User \033[1m${user_name}\033[m added:"
|
||||||
|
echo ""
|
||||||
|
echo -e " Home Dir: \033[1m$home_dir\033[m"
|
||||||
|
echo -e " UID: \033[1m$(id -u ${user_name})\033[m"
|
||||||
|
echo -e " GID: \033[1m$(id -g ${user_name})\033[m"
|
||||||
|
if [[ -n "$2" ]]; then
|
||||||
|
echo -e " Password: \033[1m$2\033[m"
|
||||||
|
else
|
||||||
|
echo -e " Password: \033[1m************\033[m"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
exit 0
|
178
cleanup_from_old_files.sh
Executable file
178
cleanup_from_old_files.sh
Executable file
@ -0,0 +1,178 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
conf_file="${working_dir}/conf/cleanup_from_old_files.conf"
|
||||||
|
|
||||||
|
LOCK_DIR="/tmp/clean_trash.LOCK"
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Some functions
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
|
||||||
|
# Perform program exit housekeeping
|
||||||
|
rm -rf "$LOCK_DIR"
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
echononl(){
|
||||||
|
if $terminal ; then
|
||||||
|
echo X\\c > /tmp/shprompt$$
|
||||||
|
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
|
||||||
|
echo -e -n "$*\\c" 1>&2
|
||||||
|
else
|
||||||
|
echo -e -n "$*" 1>&2
|
||||||
|
fi
|
||||||
|
rm /tmp/shprompt$$
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal(){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[31m\033[1mFatal\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
echo -e " \033[31m\033[1mScript was terminated\033[m!"
|
||||||
|
else
|
||||||
|
echo " [ Fatal ]: $*"
|
||||||
|
echo ""
|
||||||
|
echo " Script was terminated...."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
clean_up 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error (){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[31m\033[1mError\033[m ]: $*"
|
||||||
|
else
|
||||||
|
echo "[ Error ]: $*"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
warn (){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
|
||||||
|
else
|
||||||
|
echo "[ Warning ]: $*"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
info (){
|
||||||
|
|
||||||
|
if $terminal ; then
|
||||||
|
echo ""
|
||||||
|
echo -e " [ \033[32m\033[1mInfo\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_done() {
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e "\033[75G[ \033[32mdone\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
echo_failed(){
|
||||||
|
if $terminal && $LOGGING ; then
|
||||||
|
echo -e "\033[75G[ \033[1;31mfailed\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
echo_skipped() {
|
||||||
|
if $terminal && $LOGGING ; then
|
||||||
|
echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trim() {
|
||||||
|
local var="$*"
|
||||||
|
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||||
|
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||||
|
echo -n "$var"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Running in a terminal?
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
if [[ -t 1 ]] ; then
|
||||||
|
terminal=true
|
||||||
|
else
|
||||||
|
terminal=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Read Configurations from $conf_file
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
if [[ ! -f "$conf_file" ]]; then
|
||||||
|
fatal " Configuration file '$(basename ${conf_file})' not found!"
|
||||||
|
else
|
||||||
|
source "$conf_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z "$(trim $dirs_to_cleanup)" ]] && fatal "No directory given!"
|
||||||
|
[[ -z "$days" ]] && days=31
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Job is already running?
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
# - If job already runs, stop execution..
|
||||||
|
# -
|
||||||
|
if mkdir "$LOCK_DIR" 2> /dev/null ; then
|
||||||
|
|
||||||
|
# - Remove lockdir when the script finishes, or when it receives a signal
|
||||||
|
# -
|
||||||
|
trap clean_up SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
datum="$(date +"%d.%m.%Y %H:%M")"
|
||||||
|
|
||||||
|
msg=" [ Error ]: A previos instance of '$(basename $0)' seems already be running.\n\n Exiting now.."
|
||||||
|
|
||||||
|
error "A previos instance of the script '$(basename $0)' seems already be running."
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
traverse() {
|
||||||
|
|
||||||
|
while IFS='' read -r -d '' name ; do
|
||||||
|
|
||||||
|
[[ "$name" = ".." ]] && continue
|
||||||
|
[[ "$name" = "." ]] && continue
|
||||||
|
traverse "$name"
|
||||||
|
|
||||||
|
done < <(find "$1" -mindepth 1 -maxdepth 1 -type d -print0)
|
||||||
|
|
||||||
|
find "$1" -mindepth 1 -maxdepth 1 -type f -mtime +${days} -exec rm -f "{}" \; > /dev/null 2>&1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for dir in $dirs_to_cleanup ; do
|
||||||
|
info "Delete files from directory \033[1m${dir}\033[m older than \033[1m${days}\033[m days .."
|
||||||
|
traverse "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
# - Delete empty sub-directories
|
||||||
|
# -
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e "\033[32m\033[1m-----\033[m"
|
||||||
|
fi
|
||||||
|
for dir in $dirs_to_cleanup ; do
|
||||||
|
info "Cleanup trash directory \033[1m${dir}\033[m from empty directories .."
|
||||||
|
find $dir -depth -mindepth 1 -type d -empty -delete
|
||||||
|
done
|
||||||
|
|
||||||
|
clean_up 0
|
20
conf/cleanup_from_old_files.conf.sample
Normal file
20
conf/cleanup_from_old_files.conf.sample
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# ------------------------------------
|
||||||
|
# - Settings for script clean_trash.sh
|
||||||
|
# ------------------------------------
|
||||||
|
|
||||||
|
# - days
|
||||||
|
# -
|
||||||
|
# - Files older then 'days' will be deleted.
|
||||||
|
# -
|
||||||
|
# - Defaults to: days=31
|
||||||
|
# -
|
||||||
|
#days=31
|
||||||
|
|
||||||
|
# - dirs_to_cleanup
|
||||||
|
# -
|
||||||
|
# - Directories where files older than given days will be deleted.
|
||||||
|
# -
|
||||||
|
# - Example:
|
||||||
|
# - trash_dirs="/data/samba/transfer/.Trash /data/samba/no-backup-share/multimedia/.Trash"
|
||||||
|
# -
|
||||||
|
#dirs_to_cleanup=""
|
14
conf/set_directory_permissions.conf.sample
Normal file
14
conf/set_directory_permissions.conf.sample
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# ---------------------------------------------
|
||||||
|
# - Settings for script cleanup_samba_rights.sh
|
||||||
|
# ---------------------------------------------
|
||||||
|
|
||||||
|
# - dir_permissions
|
||||||
|
# -
|
||||||
|
# - Recursive set Permissions (group and file-/directory-mode)
|
||||||
|
# -
|
||||||
|
# - dir_permissions="<directory>:<group>:<file-mod>:<dir-mod> [<directory>:<group>:<file-mod>:<dir-mod>] .."
|
||||||
|
# -
|
||||||
|
# - Example:
|
||||||
|
# - dir_permissions="/data/samba/transfer:buero:664:2775 /data/samba/verwaltung:intern:660:2770"
|
||||||
|
# -
|
||||||
|
#dir_permissions=""
|
21
get_next_uid_gid_pair.sh
Executable file
21
get_next_uid_gid_pair.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
min_uid=1000
|
||||||
|
|
||||||
|
declare -i _id=$(expr $min_uid - 1)
|
||||||
|
|
||||||
|
while true ; do
|
||||||
|
((_id++))
|
||||||
|
$(id $_id > /dev/null 2>&1) && continue
|
||||||
|
$(cat /etc/group | cut -d ':' -f3 | grep -q $_id 2> /dev/null) && continue
|
||||||
|
break
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " Next free uid/gid pair:"
|
||||||
|
echo
|
||||||
|
echo -e " uid: \033[1m$_id\033[m"
|
||||||
|
echo -e " gid: \033[1m$_id\033[m"
|
||||||
|
echo
|
||||||
|
|
||||||
|
exit 0
|
204
set_directory_permissions.sh
Executable file
204
set_directory_permissions.sh
Executable file
@ -0,0 +1,204 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
conf_file="${working_dir}/conf/set_directory_permissions.conf"
|
||||||
|
|
||||||
|
LOCK_DIR="/tmp/set_directory_permissions.LOCK"
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Some functions
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
|
||||||
|
# Perform program exit housekeeping
|
||||||
|
rm -rf "$LOCK_DIR"
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
echononl(){
|
||||||
|
if $terminal ; then
|
||||||
|
echo X\\c > /tmp/shprompt$$
|
||||||
|
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
|
||||||
|
echo -e -n "$*\\c" 1>&2
|
||||||
|
else
|
||||||
|
echo -e -n "$*" 1>&2
|
||||||
|
fi
|
||||||
|
rm /tmp/shprompt$$
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal(){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[31m\033[1mFatal\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
echo -e " \033[31m\033[1mScript was terminated\033[m!"
|
||||||
|
else
|
||||||
|
echo " [ Fatal ]: $*"
|
||||||
|
echo ""
|
||||||
|
echo " Script was terminated...."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
clean_up 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error (){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[31m\033[1mError\033[m ]: $*"
|
||||||
|
else
|
||||||
|
echo "[ Error ]: $*"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
warn (){
|
||||||
|
echo ""
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
|
||||||
|
else
|
||||||
|
echo "[ Warning ]: $*"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
info (){
|
||||||
|
|
||||||
|
if $terminal ; then
|
||||||
|
echo ""
|
||||||
|
echo -e " [ \033[32m\033[1mInfo\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_done() {
|
||||||
|
if $terminal ; then
|
||||||
|
echo -e "\033[75G[ \033[32mdone\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
echo_failed(){
|
||||||
|
if $terminal && $LOGGING ; then
|
||||||
|
echo -e "\033[75G[ \033[1;31mfailed\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
echo_skipped() {
|
||||||
|
if $terminal && $LOGGING ; then
|
||||||
|
echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trim() {
|
||||||
|
local var="$*"
|
||||||
|
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||||
|
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||||
|
echo -n "$var"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Running in a terminal?
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
if [[ -t 1 ]] ; then
|
||||||
|
terminal=true
|
||||||
|
else
|
||||||
|
terminal=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Read Configurations from $conf_file
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
if [[ ! -f "$conf_file" ]]; then
|
||||||
|
fatal " Configuration file '$(basename ${conf_file})' not found!"
|
||||||
|
else
|
||||||
|
source "$conf_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z "$(trim $dir_permissions)" ]] && fatal "No directory given!"
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Job is already running?
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
# - If job already runs, stop execution..
|
||||||
|
# -
|
||||||
|
if mkdir "$LOCK_DIR" 2> /dev/null ; then
|
||||||
|
|
||||||
|
## - Remove lockdir when the script finishes, or when it receives a signal
|
||||||
|
trap clean_up SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
datum="$(date +"%d.%m.%Y %H:%M")"
|
||||||
|
|
||||||
|
msg=" [ Error ]: A previos instance of '$(basename $0)' seems already be running.\n\n Exiting now.."
|
||||||
|
|
||||||
|
error "A previos instance of the script '$(basename $0)' seems already be running."
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
for _dir_perm in $dir_permissions ; do
|
||||||
|
IFS=':' read -a _dir_perm_arr <<< "${_dir_perm}"
|
||||||
|
|
||||||
|
base_dir="${_dir_perm_arr[0]}"
|
||||||
|
if [[ -z "$(trim "$base_dir")" ]]; then
|
||||||
|
error "Directory not given!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ ! -d "$base_dir" ]]; then
|
||||||
|
error "Cannot find directory '$base_dir'"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
group="${_dir_perm_arr[1]}"
|
||||||
|
if [[ -z "$(trim "$group")" ]]; then
|
||||||
|
error "Group not given!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! grep -E -q "^${group}:" /etc/group ; then
|
||||||
|
error "Group '$group' does not exist!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
file_perm="${_dir_perm_arr[2]}"
|
||||||
|
if [[ -z "$(trim "$file_perm")" ]]; then
|
||||||
|
error "File permissions not given!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir_perm="${_dir_perm_arr[3]}"
|
||||||
|
if [[ -z "$(trim "$dir_perm")" ]]; then
|
||||||
|
error "Directory permissions not given!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Set Permisions on \033[1m${base_dir}\033[m: Group:\033[1m${group}\033[m Perimissions: \033[1m${dir_perm}/${file_perm}\033[m .."
|
||||||
|
|
||||||
|
chmod $dir_perm $base_dir
|
||||||
|
chgrp $group $base_dir
|
||||||
|
|
||||||
|
while IFS='' read -r -d '' filename ; do
|
||||||
|
|
||||||
|
[[ -f "$filename" ]] && ( chmod $file_perm "$filename"; chgrp $group "$filename")
|
||||||
|
[[ ! -d "$filename" ]] && continue
|
||||||
|
|
||||||
|
[[ "$filename" =~ .Trash ]] && continue
|
||||||
|
[[ "$filename" = "lost+found" ]] && continue
|
||||||
|
|
||||||
|
chmod $dir_perm "$filename" ; chgrp $group "$filename"
|
||||||
|
|
||||||
|
find "$filename" ! -group $group -exec chgrp -R $group {} \;
|
||||||
|
find "$filename" -type d ! -perm $dir_perm -exec chmod -R $dir_perm {} \;
|
||||||
|
find "$filename" -type f ! -perm $file_perm -exec chmod -R $file_perm {} \;
|
||||||
|
|
||||||
|
|
||||||
|
done < <(find $base_dir -mindepth 1 -maxdepth 1 -print0)
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
clean_up 0
|
7
supported-files/user_templates/all/.bash_logout
Normal file
7
supported-files/user_templates/all/.bash_logout
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||||
|
|
||||||
|
# when leaving the console clear the screen to increase privacy
|
||||||
|
|
||||||
|
if [ "$SHLVL" = 1 ]; then
|
||||||
|
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||||
|
fi
|
109
supported-files/user_templates/all/.bashrc
Normal file
109
supported-files/user_templates/all/.bashrc
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
# ~/.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
|
||||||
|
[ -z "$PS1" ] && return
|
||||||
|
|
||||||
|
# don't put duplicate lines in the history. See bash(1) for more options
|
||||||
|
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
|
||||||
|
HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
|
||||||
|
# ... or force ignoredups and ignorespace
|
||||||
|
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)
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
# 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) 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
|
||||||
|
|
||||||
|
# some more ls aliases
|
||||||
|
alias ll='ls -l'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias l='ls -CF'
|
||||||
|
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
|
||||||
|
# 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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
|
||||||
|
export EDITOR=vim
|
||||||
|
|
||||||
|
## - set beep more quiet
|
||||||
|
## -
|
||||||
|
#xset b 10 500 50
|
30
supported-files/user_templates/all/.profile
Normal file
30
supported-files/user_templates/all/.profile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# ~/.profile: executed by the command interpreter for login shells.
|
||||||
|
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||||
|
# exists.
|
||||||
|
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||||
|
# the files are located in the bash-doc package.
|
||||||
|
|
||||||
|
# the default umask is set in /etc/profile; for setting the umask
|
||||||
|
# for ssh logins, install and configure the libpam-umask package.
|
||||||
|
#umask 022
|
||||||
|
|
||||||
|
# if running bash
|
||||||
|
if [ -n "$BASH_VERSION" ]; then
|
||||||
|
# include .bashrc if it exists
|
||||||
|
if [ -f "$HOME/.bashrc" ]; then
|
||||||
|
. "$HOME/.bashrc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if [ -d "$HOME/bin" ] ; then
|
||||||
|
PATH="$HOME/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this is for the midnight-commander
|
||||||
|
# to become the last directory the midnight commander was in
|
||||||
|
# as the current directory when leaving the midnight commander
|
||||||
|
#
|
||||||
|
#. /usr/lib/mc/bin/mc.sh
|
||||||
|
. /usr/share/mc/bin/mc.sh
|
||||||
|
|
2
supported-files/user_templates/all/.ssh/authorized_keys2
Normal file
2
supported-files/user_templates/all/.ssh/authorized_keys2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyWbdnjnN/xfy1F6kPbsRXp8zvJEh8uHfTZuZKyaRV/iRuhsvqRiDB+AhUAlIaPwgQ8itaI6t5hijD+sZf+2oXXbNy3hkOHTrCDKCoVAWfMRKPuA1m8RqS4ZXXgayaeCzVnPEq6UrC5z0wO/XBwAktT37RRSQ/Hq2zCHy36NQEQYrhF3+ytX7ayb10pJAMVGRctYmr5YnLEVMSIREbPxZTNc80H1zqNPVJwYZhl8Ox61U4MoNhJmJwbKWPRPZsJpbTh9W2EU37tdwRBVQP6yxhua3TR6C7JnNPVY0IK23BYlNtQEDY4PHcIuewkamEWpP0+jhEjtwy1TqjRPdU/y+2uQjC6FSOVMsSPxgd8mw4cSsfp+Ard7P+YOevUXD81+jFZ3Wz0PRXbWMWAm2OCe7n8jVvkXMz+KxSYtrsvKNw1WugJq1z//bJNMTK6ISWpqaXDevGYQRJJ8dPbMmbey40WpS5CA/l29P7fj/cOl59w3LZGshrMOm7lVz9qysVV0ylfE3OpfKCGitkpY0Asw4lSkuLHoNZnDo6I5/ulRuKi6gsLk27LO5LYS8Zm1VOis/qHk1Gg1+QY47C4RzdTUxlU1CGesPIiQ1uUX2Z4bD7ebTrrOuEFcmNs3Wu5nif21Qq0ELEWhWby6ChFrbFHPn+hWlDwNM0Nr11ftwg0+sqVw== root@luna
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC5IhVprsvVOcFPbZzD9xR0nCjZ/9qVG6RhLJ7QBSts81nRvLwnmvcMBHSf5Rfaigey7Ff5dLHfJnxRE0KDATn6n2yd/5mXpn2GAA8hDVfhdsmsb5U7bROjZNr8MmIUrP7c3msUGx1FtvzhwxtyvIWOFQpWx+W5biBa6hFjIxT1pkUJqe6fclp7xbGYKZiqZRBS4qKG5CpKnisuOYDsqYPND+OkU+PShoxGVzp1JywIVze7qeKv6GyYbRA9SP9Np+5Mit6B21Io4zOI81c2Rz6sPX7mwEAQEs7iCm2hzG8qJws45Lb4ERqDkVEVhGNUyHjHgGebS1sZx1mLExdurXlPm1l/EamkncDFDCutHXtLP7lsFFiym7fKUjSEgiiLmyu5Xm+mwZvesKa1FYNaeiFWfYZpCJrNzIk+ffs+mgg3kmL4Sd4Ooy7jXPX+WJe5Xyh1KLU/+Wj2TVrhN+LbmupYAti/Wgd3DA1v601svmG82aLmyJRtKC0rGMePH3kDbtqU72kYpzI8mXERe1TIQ00Z77kQBR/7BF/9y5/0YmYDcXt1wNCoSie+mzz3xYcEdLAc7T+DhYpd4M6VgWnuz/exzRzhQwoSdEKkEED8CpEoBrEWEiMdrlElGmlkVomLU7P9i9j1rshX/pAq0asnqeSoPdC3vNbU3keiJQnhIHECvw== chris@luna
|
173
supported-files/user_templates/all/.vimrc
Normal file
173
supported-files/user_templates/all/.vimrc
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
" An example for a vimrc file.
|
||||||
|
"
|
||||||
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
|
" Last change: 1999 Sep 09
|
||||||
|
"
|
||||||
|
" To use it, copy it to
|
||||||
|
" for Unix and OS/2: ~/.vimrc
|
||||||
|
" for Amiga: s:.vimrc
|
||||||
|
" for MS-DOS and Win32: $VIM\_vimrc
|
||||||
|
|
||||||
|
" This line should not be removed as it ensures that various options are
|
||||||
|
" properly set to work with the Vim-related packages available in Debian.
|
||||||
|
runtime! debian.vim
|
||||||
|
|
||||||
|
set nocompatible " Use Vim defaults (much better!)
|
||||||
|
set bs=2 " allow backspacing over everything in insert mode
|
||||||
|
set ai " always set autoindenting on
|
||||||
|
" set backup " keep a backup file
|
||||||
|
"set viminfo='20,\"50 " read/write a .viminfo file, don't store more
|
||||||
|
" than 50 lines of registers
|
||||||
|
set viminfo='20,\"50,:20,%,n~/.viminfo
|
||||||
|
set history=50 " keep 50 lines of command line history
|
||||||
|
set ruler " show the cursor position all the time
|
||||||
|
set ignorecase " suchen case-insenitiv
|
||||||
|
set showmatch " zeige passende klammern
|
||||||
|
set shell=/bin/bash " shell to start with !
|
||||||
|
set expandtab " tabs --> blanks
|
||||||
|
set showmode " anzeige INSERT/REPLACE/...
|
||||||
|
|
||||||
|
" set smartcase " Do smart case matching
|
||||||
|
|
||||||
|
set incsearch " Incremental search
|
||||||
|
" Start searching when you type the first character of
|
||||||
|
" the search string. As you type in more characters, the
|
||||||
|
" search is refined.
|
||||||
|
|
||||||
|
set t_Co=256 " To enable 256 colors in vim, put this your .vimrc before setting the colorscheme
|
||||||
|
|
||||||
|
" einrueckung
|
||||||
|
set shiftwidth=3
|
||||||
|
set tabstop=3
|
||||||
|
" Round indent to multiple of 'shiftwidth' for > and < commands
|
||||||
|
set shiftround
|
||||||
|
|
||||||
|
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
|
||||||
|
" let &guioptions = substitute(&guioptions, "t", "", "g")
|
||||||
|
|
||||||
|
" Don't use Ex mode, use Q for formatting
|
||||||
|
map Q gq
|
||||||
|
|
||||||
|
" Make p in isual Visual mode replace the selected text with the "" register.
|
||||||
|
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
|
||||||
|
|
||||||
|
" Switch syntax highlighting on, when the terminal has colors
|
||||||
|
" Also switch on highlighting the last used search pattern.
|
||||||
|
if &t_Co > 2 || has("gui_running")
|
||||||
|
syntax on
|
||||||
|
set hlsearch
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Only do this part when compiled with support for autocommands.
|
||||||
|
if has("autocmd")
|
||||||
|
|
||||||
|
" In text files, always limit the width of text to 78 characters
|
||||||
|
autocmd BufRead *.txt set tw=78
|
||||||
|
|
||||||
|
augroup cprog
|
||||||
|
" Remove all cprog autocommands
|
||||||
|
au!
|
||||||
|
|
||||||
|
" When starting to edit a file:
|
||||||
|
" For C and C++ files set formatting of comments and set C-indenting on.
|
||||||
|
" For other files switch it off.
|
||||||
|
" Don't change the order, it's important that the line with * comes first.
|
||||||
|
autocmd FileType * set formatoptions=tcql nocindent comments&
|
||||||
|
autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup gzip
|
||||||
|
" Remove all gzip autocommands
|
||||||
|
au!
|
||||||
|
|
||||||
|
" Enable editing of gzipped files
|
||||||
|
" set binary mode before reading the file
|
||||||
|
autocmd BufReadPre,FileReadPre *.gz,*.bz2 set bin
|
||||||
|
autocmd BufReadPost,FileReadPost *.gz call GZIP_read("gunzip")
|
||||||
|
autocmd BufReadPost,FileReadPost *.bz2 call GZIP_read("bunzip2")
|
||||||
|
autocmd BufWritePost,FileWritePost *.gz call GZIP_write("gzip")
|
||||||
|
autocmd BufWritePost,FileWritePost *.bz2 call GZIP_write("bzip2")
|
||||||
|
autocmd FileAppendPre *.gz call GZIP_appre("gunzip")
|
||||||
|
autocmd FileAppendPre *.bz2 call GZIP_appre("bunzip2")
|
||||||
|
autocmd FileAppendPost *.gz call GZIP_write("gzip")
|
||||||
|
autocmd FileAppendPost *.bz2 call GZIP_write("bzip2")
|
||||||
|
|
||||||
|
" After reading compressed file: Uncompress text in buffer with "cmd"
|
||||||
|
fun! GZIP_read(cmd)
|
||||||
|
let ch_save = &ch
|
||||||
|
set ch=2
|
||||||
|
execute "'[,']!" . a:cmd
|
||||||
|
set nobin
|
||||||
|
let &ch = ch_save
|
||||||
|
execute ":doautocmd BufReadPost " . expand("%:r")
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" After writing compressed file: Compress written file with "cmd"
|
||||||
|
fun! GZIP_write(cmd)
|
||||||
|
if rename(expand("<afile>"), expand("<afile>:r")) == 0
|
||||||
|
execute "!" . a:cmd . " <afile>:r"
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Before appending to compressed file: Uncompress file with "cmd"
|
||||||
|
fun! GZIP_appre(cmd)
|
||||||
|
execute "!" . a:cmd . " <afile>"
|
||||||
|
call rename(expand("<afile>:r"), expand("<afile>"))
|
||||||
|
endfun
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" This is disabled, because it changes the jumplist. Can't use CTRL-O to go
|
||||||
|
" back to positions in previous files more than once.
|
||||||
|
if 0
|
||||||
|
" When editing a file, always jump to the last cursor position.
|
||||||
|
" This must be after the uncompress commands.
|
||||||
|
autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif " has("autocmd")
|
||||||
|
|
||||||
|
" toggle syntax highlighting
|
||||||
|
map <F12> :if exists("syntax_on") <Bar> syntax off <Bar> else <Bar> syntax on <Bar> endif <CR><ESC>
|
||||||
|
map <F11> :nohls <CR>
|
||||||
|
|
||||||
|
" use <F6> to toggle line numbers
|
||||||
|
nmap <silent> <F6> :set number!<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" If using a dark background within the editing area and syntax highlighting
|
||||||
|
" turn on this option as well
|
||||||
|
set background=dark
|
||||||
|
|
||||||
|
|
||||||
|
" set color for search
|
||||||
|
hi clear search
|
||||||
|
hi search term=bold,reverse cterm=bold,reverse gui=bold,reverse
|
||||||
|
|
||||||
|
" set color for Comment
|
||||||
|
hi clear Comment
|
||||||
|
"highlight Comment term=bold cterm=bold ctermfg=LightBlue guifg=#80a0ff gui=bold
|
||||||
|
"highlight Comment term=none cterm=none ctermfg=LightBlue guifg=#80a0ff gui=bold
|
||||||
|
"highlight Comment term=bold cterm=bold ctermfg=grey guifg=#80a0ff gui=bold
|
||||||
|
highlight Comment term=none cterm=none ctermfg=grey guifg=#80a0ff gui=bold
|
||||||
|
"highlight Comment term=none cterm=none ctermfg=177 guifg=#80a0ff gui=bold
|
||||||
|
"highlight Comment term=none cterm=none ctermfg=215 guifg=#80a0ff gui=bold
|
||||||
|
|
||||||
|
" Go back to the position the cursor was on the last time this file was edited
|
||||||
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")|execute("normal `\"")|endif
|
||||||
|
|
||||||
|
" visual shifting (does not exit Visual mode)
|
||||||
|
vnoremap < <gv
|
||||||
|
vnoremap > >gv
|
||||||
|
|
||||||
|
" Scroll when cursor gets within 3 characters of top/bottom edge
|
||||||
|
set scrolloff=3
|
||||||
|
|
||||||
|
" Show line, column number, and relative position within a file in the status line
|
||||||
|
" set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
|
||||||
|
"set statusline=\ %F\ %(\|\ flags:\ %R%M%H%W\ %)%(\|\ type:\ %Y\ %)%(\|\ format:\ %{&ff}\ %)%(\|\ syntax:\ %{synIDattr(synID(line('.'),col('.'),0),'name')}%)\ \ %=line:\ %l/%L\ \|\ column:\ %c%V\ \|\ relative\:\ %p%%\
|
||||||
|
set statusline=\ %F\ %(\|\ flags:\ %R%M%H%W\ %)%(\|\ type:\ %Y\ %)%(\|\ format:\ %{&ff}\ %)\ \ %=line:\ %l/%L\ \|\ col:\ %c%V\ \|\ %p%%
|
||||||
|
" Always show status line, even for one window
|
||||||
|
set laststatus=2
|
||||||
|
highlight StatusLine cterm=none ctermfg=white ctermbg=blue
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyWbdnjnN/xfy1F6kPbsRXp8zvJEh8uHfTZuZKyaRV/iRuhsvqRiDB+AhUAlIaPwgQ8itaI6t5hijD+sZf+2oXXbNy3hkOHTrCDKCoVAWfMRKPuA1m8RqS4ZXXgayaeCzVnPEq6UrC5z0wO/XBwAktT37RRSQ/Hq2zCHy36NQEQYrhF3+ytX7ayb10pJAMVGRctYmr5YnLEVMSIREbPxZTNc80H1zqNPVJwYZhl8Ox61U4MoNhJmJwbKWPRPZsJpbTh9W2EU37tdwRBVQP6yxhua3TR6C7JnNPVY0IK23BYlNtQEDY4PHcIuewkamEWpP0+jhEjtwy1TqjRPdU/y+2uQjC6FSOVMsSPxgd8mw4cSsfp+Ard7P+YOevUXD81+jFZ3Wz0PRXbWMWAm2OCe7n8jVvkXMz+KxSYtrsvKNw1WugJq1z//bJNMTK6ISWpqaXDevGYQRJJ8dPbMmbey40WpS5CA/l29P7fj/cOl59w3LZGshrMOm7lVz9qysVV0ylfE3OpfKCGitkpY0Asw4lSkuLHoNZnDo6I5/ulRuKi6gsLk27LO5LYS8Zm1VOis/qHk1Gg1+QY47C4RzdTUxlU1CGesPIiQ1uUX2Z4bD7ebTrrOuEFcmNs3Wu5nif21Qq0ELEWhWby6ChFrbFHPn+hWlDwNM0Nr11ftwg0+sqVw== root@luna
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC5IhVprsvVOcFPbZzD9xR0nCjZ/9qVG6RhLJ7QBSts81nRvLwnmvcMBHSf5Rfaigey7Ff5dLHfJnxRE0KDATn6n2yd/5mXpn2GAA8hDVfhdsmsb5U7bROjZNr8MmIUrP7c3msUGx1FtvzhwxtyvIWOFQpWx+W5biBa6hFjIxT1pkUJqe6fclp7xbGYKZiqZRBS4qKG5CpKnisuOYDsqYPND+OkU+PShoxGVzp1JywIVze7qeKv6GyYbRA9SP9Np+5Mit6B21Io4zOI81c2Rz6sPX7mwEAQEs7iCm2hzG8qJws45Lb4ERqDkVEVhGNUyHjHgGebS1sZx1mLExdurXlPm1l/EamkncDFDCutHXtLP7lsFFiym7fKUjSEgiiLmyu5Xm+mwZvesKa1FYNaeiFWfYZpCJrNzIk+ffs+mgg3kmL4Sd4Ooy7jXPX+WJe5Xyh1KLU/+Wj2TVrhN+LbmupYAti/Wgd3DA1v601svmG82aLmyJRtKC0rGMePH3kDbtqU72kYpzI8mXERe1TIQ00Z77kQBR/7BF/9y5/0YmYDcXt1wNCoSie+mzz3xYcEdLAc7T+DhYpd4M6VgWnuz/exzRzhQwoSdEKkEED8CpEoBrEWEiMdrlElGmlkVomLU7P9i9j1rshX/pAq0asnqeSoPdC3vNbU3keiJQnhIHECvw== chris@luna
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxRcrdHX8UHik7l1gpm7Oc4t4+1AKrkcbGtFlzrlwHV4HmMf29nMxYWdOGUv47CFoAHCPSJAH2fnER22HUozsBlMkPrAgXTsMAfpMZB2gP+F7r4c7wiCuK1+uFy2dz2yBIG+1RK+ygJ5GickHPj7baWRQVbYwWeK15YJqL8oxrL6MpmNYr/cVZ7SDLRJp/44ZgnfxC83O00yJf8VEvoOvvj46JkhgnY9RETRfp7RaziIkJGs8EfNRZ6I0vRPC/shVTXf01GH5rdBcklZYZ2ptMvriyUZ2FfMMEOA86jWs73ZGuTcx8ZQGB3m9TCvz8kTBr9CKjz+fAkfKUpMbGOpO5w== root@backup
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAmQffh8lmO69ukeW0hC7wQ8EEqEsKPja5IvYr1fVqmR5gUJDRFQ015sxpIIuLgo4kCbe6pz7aV6rLUAxysMV06PbBRJPzq0SvaXek3Begygt11U0+HFQN7pVw+agxvbdE0YwxhOfJWl8f/wkti+p/G7+G7O0bMyFdzH2eeYXmzh3Nf4NoST8moQ2PVpDaJ73u/s7Z2oPng2LhVneGqyRdV40exiFOBS5pGJZ/10GZthkrhUAEGzPTusenN4+Vw2oriKP3+eyLzsB8qSPX5u7oR4Su9QY2VxTwkuXZDrxTBZwpIB/mXobMRZeRQxDGeSsU1mCf9cquanFLIx4a1ySUDw== root@backup.warenform.de
|
71
supported-files/user_templates/root/.bashrc
Normal file
71
supported-files/user_templates/root/.bashrc
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||||
|
|
||||||
|
# don't put duplicate lines in the history. See bash(1) for more options
|
||||||
|
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
|
||||||
|
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
|
||||||
|
# ... or force ignoredups and ignorespace
|
||||||
|
export HISTCONTROL=ignoreboth
|
||||||
|
|
||||||
|
# append to the history file, don't overwrite it
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
|
||||||
|
# check the window size after each command and, if necessary,
|
||||||
|
# update the values of LINES and COLUMNS.
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
|
||||||
|
# Note: PS1 and umask are already set in /etc/profile. You should not
|
||||||
|
# need this unless you want different defaults for root.
|
||||||
|
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
|
||||||
|
# umask 022
|
||||||
|
export PS1='\h:\w \$ '
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
|
||||||
|
# You may uncomment the following lines if you want `ls' to be colorized:
|
||||||
|
export LS_OPTIONS='--color=auto'
|
||||||
|
eval "`dircolors`"
|
||||||
|
alias ls='ls $LS_OPTIONS'
|
||||||
|
alias ll='ls $LS_OPTIONS -l'
|
||||||
|
alias la='ls $LS_OPTIONS -al'
|
||||||
|
alias l='ls $LS_OPTIONS -lA'
|
||||||
|
#
|
||||||
|
# Some more alias to avoid making mistakes:
|
||||||
|
#alias rm='rm -i'
|
||||||
|
#alias cp='cp -i'
|
||||||
|
#alias mv='mv -i'
|
||||||
|
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
|
||||||
|
|
||||||
|
alias poweroff='echo -e "\n\tplease use: /sbin/poweroff\n"'
|
||||||
|
alias reboot='echo -e "\n\tplease use: /sbin/reboot\n"'
|
||||||
|
|
||||||
|
|
||||||
|
# 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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
export EDITOR=vim
|
||||||
|
|
||||||
|
export LINES=64
|
||||||
|
|
||||||
|
## - set beep more quiet
|
||||||
|
## -
|
||||||
|
#xset b 10 500 50
|
24
supported-files/user_templates/root/.profile
Normal file
24
supported-files/user_templates/root/.profile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# ~/.profile: executed by Bourne-compatible login shells.
|
||||||
|
|
||||||
|
if [ "$BASH" ]; then
|
||||||
|
if [ -f ~/.bashrc ]; then
|
||||||
|
. ~/.bashrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if [ -d "$HOME/bin" ] ; then
|
||||||
|
PATH="$HOME/bin:$PATH"
|
||||||
|
fi
|
||||||
|
if [ -d "$HOME/bin/admin-stuff" ] ; then
|
||||||
|
PATH="$HOME/bin/admin-stuff:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this is for the midnight-commander
|
||||||
|
# to become the last directory the midnight commander was in
|
||||||
|
# as the current directory when leaving the midnight commander
|
||||||
|
#
|
||||||
|
# . /usr/lib/mc/bin/mc.sh
|
||||||
|
. /usr/share/mc/bin/mc.sh
|
||||||
|
|
||||||
|
mesg n
|
Loading…
Reference in New Issue
Block a user