]> git.mar77i.info Git - admin/commitdiff
initial commit
authormar77i <mar77i@protonmail.ch>
Sun, 26 Nov 2023 00:40:03 +0000 (01:40 +0100)
committermar77i <mar77i@protonmail.ch>
Sun, 26 Nov 2023 00:40:03 +0000 (01:40 +0100)
.gitignore [new file with mode: 0644]
gitweb-theme.css [new file with mode: 0644]
post-receive.sh [new file with mode: 0755]
remote_as_root.sh [new file with mode: 0755]
update_system.sh [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9d88a30
--- /dev/null
@@ -0,0 +1,2 @@
+id_ed25519
+id_ed25519.pub
diff --git a/gitweb-theme.css b/gitweb-theme.css
new file mode 100644 (file)
index 0000000..8e654ba
--- /dev/null
@@ -0,0 +1,690 @@
+body {
+       font-family: sans-serif;
+       font-size: small;
+       border: solid #43423c;
+       border-width: 1px;
+       margin: 10px;
+       background-color: #151515;
+       color: white;
+}
+
+a {
+       color: #8484ff;
+}
+
+a:hover, a:visited, a:active {
+       color: #ffadad;
+}
+
+span.cntrl {
+       border: dashed #6a6a6a;
+       border-width: 1px;
+       padding: 0px 2px 0px 2px;
+       margin:  0px 2px 0px 2px;
+}
+
+img.logo {
+       float: right;
+       border-width: 0px;
+}
+
+img.avatar {
+       vertical-align: middle;
+}
+
+img.blob {
+       max-height: 100%;
+       max-width: 100%;
+}
+
+a.list img.avatar {
+       border-style: none;
+}
+
+div.page_header {
+       height: 25px;
+       padding: 8px;
+       font-size: 150%;
+       font-weight: bold;
+       background-color: #43423c;
+}
+
+div.page_header a:visited, a.header {
+       color: #8484ff;
+}
+
+div.page_header a:hover {
+       color: #ffadad;
+}
+
+div.page_nav {
+       padding: 8px;
+}
+
+div.page_nav a:visited {
+       color: #8484ff;
+}
+
+div.page_path {
+       padding: 8px;
+       font-weight: bold;
+       border: solid #43423c;
+       border-width: 0px 0px 1px;
+}
+
+div.page_footer {
+       height: 22px;
+       padding: 4px 8px;
+       background-color: #43423c;
+}
+
+div.page_footer_text {
+       line-height: 22px;
+       float: left;
+       color: #bfbfbf;
+       font-style: italic;
+}
+
+div#generating_info {
+       margin: 4px;
+       font-size: smaller;
+       text-align: center;
+       color: #c4c4c4;
+}
+
+div.page_body {
+       padding: 8px;
+       font-family: monospace;
+}
+
+div.title, a.title {
+       display: block;
+       padding: 6px 8px;
+       font-weight: bold;
+       background-color: #2e2d26;
+       text-decoration: none;
+       color: white;
+}
+
+div.readme {
+       padding: 8px;
+}
+
+a.title:hover {
+       background-color: #43423c;
+}
+
+div.title_text {
+       padding: 6px 0px;
+       border: solid #43423c;
+       border-width: 0px 0px 1px;
+       font-family: monospace;
+}
+
+div.log_body {
+       padding: 8px 8px 8px 150px;
+}
+
+span.age {
+       position: relative;
+       float: left;
+       width: 142px;
+       font-style: italic;
+}
+
+span.signoff {
+       color: #8c8c8c;
+}
+
+div.log_link {
+       padding: 0px 8px;
+       font-size: 70%;
+       font-family: sans-serif;
+       font-style: normal;
+       position: relative;
+       float: left;
+       width: 136px;
+}
+
+div.list_head {
+       padding: 6px 8px 4px;
+       border: solid #43423c;
+       border-width: 1px 0px 0px;
+       font-style: italic;
+}
+
+.author_date, .author {
+       font-style: italic;
+}
+
+div.author_date {
+       padding: 8px;
+       border: solid #43423c;
+       border-width: 0px 0px 1px 0px;
+}
+
+a.list {
+       text-decoration: none;
+       color: white;
+}
+
+a.subject, a.name {
+       font-weight: bold;
+}
+
+table.tags a.subject {
+       font-weight: normal;
+}
+
+a.list:hover {
+       text-decoration: underline;
+       color: #ffadad;
+}
+
+a.text {
+       text-decoration: none;
+       color: #8484ff;
+}
+
+a.text:visited {
+       text-decoration: none;
+       color: #ffadad;
+}
+
+a.text:hover {
+       text-decoration: underline;
+       color: #ffadad;
+}
+
+table {
+       padding: 8px 4px;
+       border-spacing: 0;
+}
+
+table.diff_tree {
+       font-family: monospace;
+}
+
+table.combined.diff_tree th {
+       text-align: center;
+}
+
+table.combined.diff_tree td {
+       padding-right: 24px;
+}
+
+table.combined.diff_tree th.link,
+table.combined.diff_tree td.link {
+       padding: 0px 2px;
+}
+
+table.combined.diff_tree td.nochange a {
+       color: #4545ae;
+}
+
+table.combined.diff_tree td.nochange a:hover,
+table.combined.diff_tree td.nochange a:visited {
+       color: #ae6565;
+}
+
+table.blame {
+       border-collapse: collapse;
+}
+
+table.blame td {
+       padding: 0px 5px;
+       font-size: 100%;
+       vertical-align: top;
+}
+
+th {
+       padding: 2px 5px;
+       font-size: 100%;
+       text-align: left;
+}
+
+/* do not change row style on hover for 'blame' view */
+tr.light,
+table.blame .light:hover {
+       background-color: #151515;
+}
+
+tr.dark,
+table.blame .dark:hover {
+       background-color: #24241b;
+}
+
+/* currently both use the same, but it can change */
+tr.light:hover,
+tr.dark:hover {
+       background-color: #2e2d26;
+}
+
+/* boundary commits in 'blame' view */
+/* and commits without "previous" */
+tr.boundary td.sha1,
+tr.no-previous td.linenr {
+       font-weight: bold;
+}
+
+/* for 'blame_incremental', during processing */
+tr.color1 { background-color: #0c1e0c; }
+tr.color2 { background-color: #0c0c1e; }
+tr.color3 { background-color: #1e0c0c; }
+
+td {
+       padding: 2px 5px;
+       font-size: 100%;
+       vertical-align: top;
+}
+
+td.link, td.selflink {
+       padding: 2px 5px;
+       font-family: sans-serif;
+       font-size: 70%;
+}
+
+td.selflink {
+       padding-right: 0px;
+}
+
+td.sha1 {
+       font-family: monospace;
+}
+
+.error {
+       color: #ff6666;
+       background-color: #fffe66;
+}
+
+td.current_head {
+       text-decoration: underline;
+}
+
+td.category {
+       background-color: #43423c;
+       border-top: 1px solid white;
+       border-left: 1px solid white;
+       font-weight: bold;
+}
+
+table.diff_tree span.file_status.new {
+       color: #b2ffb2;
+}
+
+table.diff_tree span.file_status.deleted {
+       color: #ff8b8b;
+}
+
+table.diff_tree span.file_status.moved,
+table.diff_tree span.file_status.mode_chnge {
+       color: #9d9d9d;
+}
+
+table.diff_tree span.file_status.copied {
+       color: #83a483;
+}
+
+/* noage: "No commits" */
+table.project_list td.noage {
+       color: #949494;
+       font-style: italic;
+}
+
+/* age2: 60*60*24*2 <= age */
+table.project_list td.age2, table.blame td.age2 {
+       font-style: italic;
+}
+
+/* age1: 60*60*2 <= age < 60*60*24*2 */
+table.project_list td.age1 {
+       color: #a3ffa3;
+       font-style: italic;
+}
+
+table.blame td.age1 {
+       color: #a3ffa3;
+       background: transparent;
+}
+
+/* age0: age < 60*60*2 */
+table.project_list td.age0 {
+       color: #a3ffa3;
+       font-style: italic;
+       font-weight: bold;
+}
+
+table.blame td.age0 {
+       color: #a3ffa3;
+       background: transparent;
+       font-weight: bold;
+}
+
+td.pre, div.pre, div.diff {
+       font-family: monospace;
+       font-size: 12px;
+       white-space: pre;
+}
+
+td.mode {
+       font-family: monospace;
+}
+
+/* progress of blame_interactive */
+div#progress_bar {
+       height: 2px;
+       margin-bottom: -2px;
+       background-color: #43443c;
+}
+div#progress_info {
+       float: right;
+       text-align: right;
+}
+
+/* format of (optional) objects size in 'tree' view */
+td.size {
+       font-family: monospace;
+       text-align: right;
+}
+
+/* styling of diffs (patchsets): commitdiff and blobdiff views */
+div.diff.header,
+div.diff.extended_header {
+       white-space: normal;
+}
+
+div.diff.header {
+       font-weight: bold;
+
+       background-color: #2e2d26;
+
+       margin-top: 4px;
+       padding: 4px 0px 2px 0px;
+       border: solid #43423c;
+       border-width: 1px 0px 1px 0px;
+}
+
+div.diff.header a.path {
+       text-decoration: underline;
+}
+
+div.diff.extended_header,
+div.diff.extended_header a.path,
+div.diff.extended_header a.hash {
+       color: #9d9d9d;
+}
+
+div.diff.extended_header .info {
+       color: #646464;
+}
+
+div.diff.extended_header {
+       background-color: #26241b;
+       padding: 2px 0px 2px 0px;
+}
+
+div.diff a.list,
+div.diff a.path,
+div.diff a.hash {
+       text-decoration: none;
+}
+
+div.diff a.list:hover,
+div.diff a.path:hover,
+div.diff a.hash:hover {
+       text-decoration: underline;
+}
+
+div.diff.to_file a.path,
+div.diff.to_file {
+       color: #bbffbb;
+}
+
+div.diff.add {
+       color: #adffad;
+}
+
+div.diff.add span.marked {
+       background-color: #2a6a2a;
+}
+
+div.diff.from_file a.path,
+div.diff.from_file {
+       color: #ff9999;
+}
+
+div.diff.rem {
+       color: #ff8484;
+}
+
+div.diff.rem span.marked {
+       background-color: #6a2a2a;
+}
+
+div.diff.chunk_header a,
+div.diff.chunk_header {
+       color: #ffa3ff;
+}
+
+div.diff.chunk_header {
+       border: dotted #341434;
+       border-width: 1px 0px 0px 0px;
+       margin-top: 2px;
+}
+
+div.diff.chunk_header span.chunk_info {
+       background-color: #260f26;
+}
+
+div.diff.chunk_header span.section {
+       color: #f298f2;
+}
+
+div.diff.incomplete {
+       color: #484848;
+}
+
+div.diff.nodifferences {
+       font-weight: bold;
+       color: #ffc5c5;
+}
+
+/* side-by-side diff */
+div.chunk_block {
+       overflow: hidden;
+}
+
+div.chunk_block div.old {
+       float: left;
+       width: 50%;
+       overflow: hidden;
+}
+
+div.chunk_block div.new {
+       margin-left: 50%;
+       width: 50%;
+}
+
+div.chunk_block.rem div.old div.diff.rem {
+       background-color: #1f0c0c;
+}
+div.chunk_block.add div.new div.diff.add {
+       background-color: #0b1c0b;
+}
+div.chunk_block.chg div     div.diff {
+       background-color: #24240e;
+}
+div.chunk_block.ctx div     div.diff.ctx {
+       color: #d4d4d4;
+}
+
+
+div.index_include {
+       border: solid #43423c;
+       border-width: 0px 0px 1px;
+       padding: 12px 8px;
+}
+
+div.search {
+       font-size: 100%;
+       font-weight: normal;
+       margin: 4px 8px;
+       float: right;
+       top: 56px;
+       right: 12px
+}
+
+div.projsearch {
+       text-align: center;
+       margin: 20px 0px;
+}
+
+div.projsearch form {
+       margin-bottom: 2px;
+}
+
+td.linenr {
+       text-align: right;
+}
+
+a.linenr {
+       color: #7b7b7b;
+       text-decoration: none
+}
+
+a.rss_logo {
+       float: right;
+       padding: 3px 5px;
+       line-height: 10px;
+       border: 1px solid;
+       border-color: #6f472e #ffd2b4 #ffe9da #c67f4f;
+       color: #151515;
+       background-color: #ffa366;
+       font-weight: bold;
+       font-family: sans-serif;
+       font-size: 70%;
+       text-align: center;
+       text-decoration: none;
+}
+
+a.rss_logo:hover {
+       background-color: #ffa370;
+}
+
+a.rss_logo.generic {
+       background-color: #ffb766;
+}
+
+a.rss_logo.generic:hover {
+       background-color: #ffb770;
+}
+
+span.refs span {
+       padding: 0px 4px;
+       font-size: 70%;
+       font-weight: normal;
+       border: 1px solid;
+       background-color: #6a2a6a;
+       border-color: #481c48 #ff66f4 #ff66f4 #481c48;
+}
+
+span.refs span a {
+       text-decoration: none;
+       color: inherit;
+}
+
+span.refs span a:hover {
+       text-decoration: underline;
+}
+
+span.refs span.indirect {
+       font-style: italic;
+}
+
+span.refs span.ref {
+       background-color: #2a2a6a;
+       border-color: #1c1c48 #84a3ff #84a3ff #1c1c48;
+}
+
+span.refs span.tag {
+       background-color: #6a6a2a;
+       border-color: #48481c #fff466 #fff466 #48481c;
+}
+
+span.refs span.head {
+       background-color: #2a6a2a;
+       border-color: #1c481c #84ffa3 #84ffa3 #1c481c;
+}
+
+span.atnight {
+       color: #ff8484;
+}
+
+span.match {
+       color: #ff7878;
+}
+
+div.binary {
+       font-style: italic;
+}
+
+div.remote {
+       margin: .5em;
+       border: 1px solid #43423c;
+       display: inline-block;
+}
+
+/* JavaScript-based timezone manipulation */
+
+.popup { /* timezone selection UI */
+       position: absolute;
+       /* "top: 0; right: 0;" would be better, if not for bugs in browsers */
+       top: 0; left: 0;
+       border: 1px solid;
+       padding: 2px;
+       background-color: #242424;
+       font-style: normal;
+       color: white;
+       cursor: auto;
+}
+
+.close-button { /* close timezone selection UI without selecting */
+       /* float doesn't work within absolutely positioned container,
+        * if width of container is not set explicitly */
+       /* float: right; */
+       position: absolute;
+       top: 0px; right: 0px;
+       border: 1px solid #b2ffb2;
+       margin: 1px 1px 1px 1px;
+       padding-bottom: 2px;
+       width: 12px;
+       height: 10px;
+       font-size: 9px;
+       font-weight: bold;
+       text-align: center;
+       background-color: #240e0e;
+       cursor: pointer;
+}
+
+
+/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */
+
+/* Highlighting theme definition: */
+
+.num    { color: #5f5eec; }
+.esc    { color: #ff66ff; }
+.str    { color: #ff6666; }
+.dstr   { color: #fffeb1; }
+.slc    { color: #939193;
+; font-style:italic;  }
+.com    { color: #939193;
+; font-style:italic;  }
+.dir    { color: #b1ffb1; }
+.sym    { color: white; }
+.line   { color: #bfbfbf; }
+.kwa    { color: white;
+; font-weight:bold;  }
+.kwb    { color: #ffb0b0; }
+.kwc    { color: white;
+; font-weight:bold;  }
+.kwd    { color: #b1b1ff; }
diff --git a/post-receive.sh b/post-receive.sh
new file mode 100755 (executable)
index 0000000..9ed695f
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+read -r -d '' hook <<'EOF'
+#!/usr/bin/env bash
+while read _ _ refname; do
+    if [[ "${refname}" == refs/heads/master ]]; then
+        . <(git show master:post-receive.sh)
+        break
+    fi
+done
+EOF
+
+hook_hash="$(printf '%s' "${hook}"|sha256sum| cut -d\  -f1)"
+[[ -f "${dest}" ]] && current_hash="$(sha256sum hooks/post-receive| cut -d\  -f1)"
+
+print_and_run() {
+    printf ">>>"
+    for (( i = 1; i < $# + 1; i++ )); do
+        printf ' %q' "${!i}"
+    done
+    printf "\n"
+    "$@"
+}
+
+update_post_receive_hook() {
+    local stat_cmd="\$(stat -c %a hooks/post-receive)"
+    print_and_run bash -c "cat >hooks/post-receive <<'EOF'"$'\n'"${hook}"$'\nEOF\n'
+    print_and_run bash -c "[[ ${stat_cmd} == 755 ]] || chmod 755 hooks/post-receive"
+}
+
+if [[ "${1}" == --install ]]; then
+    if (( $# > 1 )); then
+        echo "Error: No further arguments expected." >&2
+        exit 1
+    fi
+    update_post_receive_hook
+    exit
+fi
+
+[[ "${hook_hash}" != "${current_hash}" ]] && update_post_receive_hook
+
+update_gitweb_theme() {
+    local theme_css_dest="${HOME}/gitweb/gitweb-theme.css"
+    print_and_run bash -c "git show master:gitweb-theme.css > ${theme_css_dest}"
+}
+
+tasks=(update_gitweb_theme)
+
+for task in "${tasks[@]}"; do
+    "${task}"
+done
diff --git a/remote_as_root.sh b/remote_as_root.sh
new file mode 100755 (executable)
index 0000000..5f441c6
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+# this works if the remote has pam_ssh_agent_auth with the local id_ed25519.pub set up
+
+script="$(realpath -e "${0}")"
+script_dir="${script%/*}"
+
+get_ssh_agent_socket() {
+    local tmpdir="${TMPDIR:-/tmp}"
+    local former_nullglob_set=0 found=0 output
+    shopt -q nullglob && former_nullglob_set=1
+    shopt -s nullglob
+    for SSH_AUTH_SOCK in "${tmpdir}"/ssh-*/agent.*; do
+        output="$(ssh-add -l 2>&1)"
+        [[ "${output}" == "Error connecting to agent: Connection refused" ]] && continue
+        export SSH_AUTH_SOCK
+        found=1
+        break
+    done
+    (( found == 0 )) && . <(ssh-agent)
+    (( former_nullglob_set )) || shopt -u nullglob
+    return 0
+}
+
+add_ssh_key() {
+    local privkey="${script_dir}/${1}"
+    [[ ! -f "${privkey}" ]] && ssh-keygen -t "${1}" -b 521 -f "${privkey}"
+    grep -qE "^$(ssh-keygen -lf "${privkey}"|sed -r 's/([][{}|()+?])/\\\1/g')\$" \
+        <(ssh-add -l) || ssh-add "${privkey}"
+}
+
+get_ssh_agent_socket
+add_ssh_key id_ed25519
+
+script_b64="$(gzip -9<"${2}"|base64 -w0)"
+launcher="$(printf '%q' '. <(printf "%s" "'"${script_b64}"'"|base64 -d|gunzip)')"
+ssh -o ForwardX11=no -At "${1}" sudo bash -c "${launcher}"
diff --git a/update_system.sh b/update_system.sh
new file mode 100644 (file)
index 0000000..39e7862
--- /dev/null
@@ -0,0 +1,13 @@
+print_and_run() {
+    printf ">>>"
+    for (( i = 1; i < $# + 1; i++ )); do
+        printf ' %q' "${!i}"
+    done
+    printf "\n"
+    "$@"
+}
+
+print_and_run pacman -Syu
+print_and_run pacdiff -f -o
+cd
+print_and_run bash