mirror of
https://github.com/ff4500/utilities.git
synced 2026-07-01 11:47:04 -05:00
archive repo initial push
This commit is contained in:
15
backup/archive_repos/_lib/colors.sh
Normal file
15
backup/archive_repos/_lib/colors.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Sourced colors
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#source ./lib/c/base.sh
|
||||
|
||||
# UI colors
|
||||
# ------------------------------------------------------------------------------
|
||||
ui_base="${ff_lightpurple_bg}"
|
||||
ui_accent_light="${ff_lightpurple}"
|
||||
ui_accent_dark="${ff_darkpurple}"
|
||||
ui_text_normal=""
|
||||
ui_text_muted="${ff_lightgrey}"
|
||||
ui_dialog_bg="${ff_darkgrey_02_bg}"
|
||||
29
backup/archive_repos/_lib/config.sh
Executable file
29
backup/archive_repos/_lib/config.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# User configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# User specified directories
|
||||
# ------------------------------------------------------------------------------
|
||||
# base_dir="/Volumes/xxx/xxx/xxx"
|
||||
# source_repo_dir="repos"
|
||||
# output_dir="archive"
|
||||
# repo_list="${base_dir}/_src/repo_list.txt"
|
||||
#
|
||||
# # Variables for functions - Don't mess with these
|
||||
# # ------------------------------------------------------------------------------
|
||||
# filelines="$(cat $repo_list)"
|
||||
# source="${base_dir}/${source_repo_dir}"
|
||||
# output="${base_dir}/${output_dir}"
|
||||
|
||||
# Debugging
|
||||
# ------------------------------------------------------------------------------
|
||||
print_colors="yes"
|
||||
|
||||
# Colors - source the colors.sh file
|
||||
# ------------------------------------------------------------------------------
|
||||
source ./_lib/colors.sh
|
||||
90
backup/archive_repos/_lib/functions.sh
Executable file
90
backup/archive_repos/_lib/functions.sh
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
indent() {
|
||||
local ind=" "
|
||||
printf "${ind}"
|
||||
}
|
||||
|
||||
sep() {
|
||||
local ch="-"
|
||||
local sep_line="$(printf '%*s' "60" | tr ' ' "$ch")"
|
||||
echo -e "${indent}${grey}${sep_line}${reset}${indent}"
|
||||
#echo -e "-----------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
|
||||
# Check directory existence
|
||||
# -----------------------------------------------
|
||||
|
||||
# if [ ! -d "${source}" ]; then
|
||||
# mkdir ${source}
|
||||
# fi
|
||||
#
|
||||
# if [ ! -d "${output}" ]; then
|
||||
# mkdir ${output}
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# # Clone everything in repo_list to source folder
|
||||
# # -----------------------------------------------
|
||||
#
|
||||
# while read line; do
|
||||
# #echo -e "git clone $line";
|
||||
# git -C $source/ clone --quiet $line
|
||||
# done < ${repo_list}
|
||||
#
|
||||
#
|
||||
# # Archive repos
|
||||
# # -----------------------------------------------
|
||||
#
|
||||
# cd ${source}
|
||||
#
|
||||
# for dir in */
|
||||
# do
|
||||
# base=$(basename "$dir")
|
||||
# tar -czf "${base}.tar.gz" "$dir"
|
||||
# done
|
||||
#
|
||||
#
|
||||
# # Copy archive files to output folder
|
||||
# # -----------------------------------------------
|
||||
#
|
||||
# mv *.tar.gz ${output}
|
||||
|
||||
|
||||
# Cleanup
|
||||
# -----------------------------------------------
|
||||
|
||||
zzz (){
|
||||
for line in $filelines; do
|
||||
suffix=".git"
|
||||
pre="${line##*/}"
|
||||
pre=${pre%"${suffix}"}
|
||||
f="${output}/${pre}.tar.gz"
|
||||
if [ ! -f "$f" ]; then
|
||||
sep
|
||||
echo
|
||||
indent; echo -e "WARNING: FILE DOES NOT EXIST!"
|
||||
echo
|
||||
indent; echo -e "${pre}.tar.gz should have been automatically created in"
|
||||
indent; echo -e "${f},"
|
||||
indent; echo -e "but for some reason it wasn't."
|
||||
indent; echo
|
||||
indent; echo -e "Check the source directory and try to run the archive operation manually:"
|
||||
indent; echo -e "tar -czf $(echo "${pre}").tar.gz $(echo "${output}/")"
|
||||
echo
|
||||
sep
|
||||
# else
|
||||
# echo -e "It's there! \c"
|
||||
# echo -e "${f}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#zzz
|
||||
|
||||
run() {
|
||||
sep
|
||||
indent; echo "Yay"
|
||||
sep
|
||||
}
|
||||
0
backup/archive_repos/_src/repo_list.txt
Normal file
0
backup/archive_repos/_src/repo_list.txt
Normal file
6
backup/archive_repos/run.sh
Executable file
6
backup/archive_repos/run.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ./_lib/config.sh
|
||||
source ./_lib/functions.sh
|
||||
|
||||
run
|
||||
Reference in New Issue
Block a user