diff --git a/snippets/cloud-init.sh b/snippets/cloud-init.sh new file mode 100644 index 0000000..e4963b3 --- /dev/null +++ b/snippets/cloud-init.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh + +## +# Re-run everything. +## + +# 1. Clean the existing configuration. +sudo cloud-init clean --logs + +# 2. Detect local data sources. +sudo cloud-init init --local + +# 3. Detect any data source requiring the network and run the 'initialization' modules. +sudo cloud-init init + +# 4. Run the 'configuration' modules. +sudo cloud-init modules --mode='config' + +# 5. Run the 'final' modules. +sudo cloud-init modules -m 'final' + +# All together now! +sudo cloud-init clean --logs +sudo cloud-init init --local +sudo cloud-init init +sudo cloud-init modules --mode='config' +sudo cloud-init modules -m 'final' diff --git a/snippets/git.change-the-default-branch-from-master-to-main.sh b/snippets/git.sh old mode 100755 new mode 100644 similarity index 50% rename from snippets/git.change-the-default-branch-from-master-to-main.sh rename to snippets/git.sh index a6bb3e8..f734f79 --- a/snippets/git.change-the-default-branch-from-master-to-main.sh +++ b/snippets/git.sh @@ -1,7 +1,19 @@ -#!/bin/sh +#!/usr/bin/env sh -# sources: -# - https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/ +## +# Remove files from the latest commit. +# The easiest way is to use `git gui`: 'Commit' => 'Amend Last Commit' => uncheck the files => 'Commit'. +## + +git reset --soft HEAD~1 # or `git reset --soft HEAD^` +git restore --staged '.lefthook-local.yml' # or `git reset HEAD '.lefthook-local.yml'` +git commit -c ORIG_HEAD + + +## +# Change the default branch from 'master' to 'main'. +# Source: https://stevenmortimer.com/5-steps-to-change-github-default-branch-from-master-to-main/ +## # create main branch locally, taking the history from master git branch --move 'master' 'main' diff --git a/snippets/gitlab.package.sh b/snippets/gitlab.package.sh index f1eccbf..20242ab 100644 --- a/snippets/gitlab.package.sh +++ b/snippets/gitlab.package.sh @@ -84,12 +84,11 @@ gitlab-rails runner ' # Package upgrade sudo yum check-update -sudo yum info 'gitlab-ee' # informational -sudo rpm -qa | grep 'gitlab-ee' # informational +sudo yum info 'gitlab-ee' # informational +sudo rpm -qa | grep 'gitlab-ee' # informational sudo yum --showduplicates list available 'gitlab-ee' -sudo gitlab-backup create # not strictly necessary: the upgrade will create a partial one -tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'" -tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee-16.11.3'" +sudo gitlab-backup create # not strictly necessary: the upgrade will create a partial one +tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'" # 'gitlab-ee-16.11.3' if version-specific sudo gitlab-rake 'gitlab:check' # Password reset