Solus scripts update
Move all solus scripts to their own directory Add script to go to oct tool in infra repo
This commit is contained in:
parent
a6eb16a24b
commit
6aa44ea7e8
4 changed files with 23 additions and 0 deletions
38
solus_utility/solus_dev_setup.sh
Executable file
38
solus_utility/solus_dev_setup.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
first="Tracey"
|
||||
last="Clark"
|
||||
email="tracey_dev@tlcnet.info"
|
||||
phabtoken=`cat ~/.phab_token_solus`
|
||||
|
||||
# Switch to unstable repository and install applications
|
||||
sudo eopkg ar Solus https://mirrors.rit.edu/solus/packages/unstable/eopkg-index.xml.xz
|
||||
sudo eopkg enable-repo Solus-Dev
|
||||
sudo eopkg up -y
|
||||
sudo eopkg install vscode htop zsh openssh vim ripgrep micro
|
||||
|
||||
# Install and setup build tools
|
||||
sudo eopkg it -c system.devel
|
||||
sudo eopkg it solbuild arcanist solbuild-config-unstable
|
||||
sudo solbuild init
|
||||
sudo solbuild update
|
||||
|
||||
mkdir ~/packaging
|
||||
cd ~/packaging
|
||||
git clone https://dev.getsol.us/source/common.git
|
||||
|
||||
ln -sv common/Makefile.common .
|
||||
ln -sv common/Makefile.toplevel Makefile
|
||||
ln -sv common/Makefile.iso .
|
||||
|
||||
touch ~/.gitignore
|
||||
echo '*~' >> ~/.gitignore
|
||||
git config --global core.excludesFile ~/.gitignore
|
||||
git config --global user.name "$first $last"
|
||||
git config --global user.email $email
|
||||
|
||||
mkdir -p ~/.solus/
|
||||
echo -e "[Packager]\nName=$first $last\nEmail=$email" > ~/.solus/packager
|
||||
|
||||
arc set-config default https://dev.getsol.us
|
||||
#arc install-certificate $phabtoken
|
||||
23
solus_utility/solus_goto_oct.sh
Executable file
23
solus_utility/solus_goto_oct.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
# Update solus infra repo and get to oct directory
|
||||
# Used when emailing OC backers
|
||||
|
||||
function update_repos() {
|
||||
printf "[INFO] Updating the Solus package repo\n"
|
||||
gotosoluspkgs
|
||||
git switch main
|
||||
git fetch && git pull
|
||||
|
||||
printf "[INFO] Updating the Solus infrastructure-tooling repo \n"
|
||||
cd infrastructure-tooling
|
||||
git switch master
|
||||
git fetch && git pull
|
||||
|
||||
printf "[INFO] Switching to the oct directory\n"
|
||||
cd oct
|
||||
exec bash
|
||||
}
|
||||
|
||||
source ~/.bashrc.d/solus-monorepo-helpers.sh
|
||||
|
||||
update_repos
|
||||
63
solus_utility/solus_package_backup.sh
Executable file
63
solus_utility/solus_package_backup.sh
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function usage {
|
||||
echo "./$(basename "$0")[-h] [-v] -- Makes a list of installed packages for Solus, and saves it to ~/InstalledPackages
|
||||
|
||||
where:
|
||||
-h show this help text
|
||||
-v Show verbose output
|
||||
"
|
||||
}
|
||||
|
||||
function print_out {
|
||||
local MESSAGE="$*"
|
||||
if [[ "${VERBOSE}" == true ]];then
|
||||
echo "$MESSAGE"
|
||||
fi
|
||||
}
|
||||
|
||||
function execute {
|
||||
local COMMAND="$*"
|
||||
if [[ "${VERBOSE}" == true ]];then
|
||||
bash -c "${COMMAND}"
|
||||
fi
|
||||
}
|
||||
|
||||
FILE=~/InstalledPackages
|
||||
|
||||
# list of arguments expected in the input
|
||||
optstring=":hv"
|
||||
|
||||
while getopts ${optstring} option; do
|
||||
case "${option}" in
|
||||
h) usage
|
||||
exit
|
||||
;;
|
||||
v)
|
||||
VERBOSE='true'
|
||||
print_out "Verbose mode is ON"
|
||||
;;
|
||||
?)
|
||||
echo "Invalid option: -${OPTARG}." >&2
|
||||
echo usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
print_out "Exporting all installed package names to ${FILE}"
|
||||
eopkg li | cut -d " " -f 1 | tr '\n' ' ' > ${FILE}
|
||||
|
||||
if [ -s "${FILE}" ]; then
|
||||
print_out "${FILE} successfully written."
|
||||
else
|
||||
echo "${FILE} does not exist or is empty! Something went wrong. Trying to cat the file:"
|
||||
|
||||
cat ~/InstalledPackages
|
||||
fi
|
||||
|
||||
print_out "Content of ${FILE}"
|
||||
execute "cat ${FILE} && echo"
|
||||
|
||||
echo "Finished exporting package names"
|
||||
135
solus_utility/solus_package_restore.sh
Executable file
135
solus_utility/solus_package_restore.sh
Executable file
|
|
@ -0,0 +1,135 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function usage {
|
||||
echo "./$(basename "$0")[-h] [-r -d -y] -- Makes a list of installed packages for Solus, optionaly removes package cache, adds the repo specified and reinstalls packages
|
||||
|
||||
where:
|
||||
-h Show this help text
|
||||
-b Back up list of packages even if the backup file already exists
|
||||
-d Delete the repo cache
|
||||
-r Repo to install: stable (default) or unstable
|
||||
-v Show verbose output
|
||||
|
||||
Ex:
|
||||
Restore the unstable repo and packages
|
||||
solus_package_restore.sh -r unstable
|
||||
|
||||
Make package backup, delete repo cache, restore the unstable repo and packages
|
||||
solus_package_restore.sh -b -d -r unstable
|
||||
"
|
||||
}
|
||||
|
||||
function print_out {
|
||||
local MESSAGE="$*"
|
||||
if [[ "${VERBOSE}" == true ]];then
|
||||
echo "$MESSAGE"
|
||||
fi
|
||||
}
|
||||
|
||||
function savepkgs {
|
||||
echo "Saving package list as requested"
|
||||
source "${FOLDER}"/solus_package_backup.sh
|
||||
}
|
||||
|
||||
function delete_cache {
|
||||
if [[ "${DELCACHE}" == true ]];then
|
||||
print_out "Deleting the package cache"
|
||||
sudo rm -rf /var/lib/eopkg/*
|
||||
print_out "Rebuilding package database"
|
||||
sudo eopkg rdb
|
||||
fi
|
||||
}
|
||||
|
||||
function check_repo_status {
|
||||
echo "Checking repo status"
|
||||
STABLE_STATUS=$(sudo eopkg list-repo |sed -n '/Solus \+/p')
|
||||
UNSTABLE_STATUS=$(sudo eopkg list-repo |sed -n '/Solus-Dev \+/p')
|
||||
|
||||
}
|
||||
|
||||
function install_repo {
|
||||
sudo eopkg ar $NAME $URL
|
||||
sudo eopkg enable-repo $NAME
|
||||
}
|
||||
|
||||
# Set defaults
|
||||
FILE=~/InstalledPackages
|
||||
FOLDER=~/git/shell-scripts
|
||||
REPO=stable
|
||||
NAME=Solus
|
||||
URL=https://mirrors.rit.edu/solus/packages/shannon/eopkg-index.xml.xz
|
||||
|
||||
# list of arguments expected in the input
|
||||
optstring=":hbdr:v"
|
||||
|
||||
while getopts ${optstring} option; do
|
||||
case "${option}" in
|
||||
h) usage
|
||||
exit
|
||||
;;
|
||||
b)
|
||||
BACKUP_PKGS='true'
|
||||
;;
|
||||
d) DELCACHE='true'
|
||||
delete_cache
|
||||
;;
|
||||
r) REPO="${OPTARG}"
|
||||
;;
|
||||
v)
|
||||
VERBOSE='true'
|
||||
print_out "Verbose mode is ON"
|
||||
;;
|
||||
?)
|
||||
echo "Invalid option: -${OPTARG}." >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
print_out "Repo to install from: $REPO"
|
||||
# Export all installed packages to a text file in one line if the file does not exist
|
||||
if [ -f "${FILE}" ]; then
|
||||
print_out "Package list file ${FILE} found."
|
||||
else
|
||||
echo "${FILE} does not exist or is empty! Making a backup of packages now."
|
||||
|
||||
savepkgs
|
||||
fi
|
||||
|
||||
if [[ "${BACKUP_PKGS}" == true ]];then
|
||||
savepkgs
|
||||
fi
|
||||
|
||||
check_repo_status
|
||||
|
||||
# Add stable repo and enable if necessary
|
||||
# The stable repo should always be installed
|
||||
if [[ $STABLE_STATUS =~ active ]]; then
|
||||
print_out "Stable repo is already installed"
|
||||
else
|
||||
echo "Installing and enabling the stable repo"
|
||||
install_repo
|
||||
fi
|
||||
|
||||
# Add unstable repo and enable based on input
|
||||
if [[ ${REPO} = 'unstable' ]]; then
|
||||
print_out "Checking the unstable repo"
|
||||
if [[ $UNSTABLE_STATUS =~ active ]]; then
|
||||
echo "Unstable repo is already installed"
|
||||
else
|
||||
echo "Installing and enabling the unstable repo, disabling the stable repo"
|
||||
URL=https://mirrors.rit.edu/solus/packages/unstable/eopkg-index.xml.xz
|
||||
NAME=Solus-Dev
|
||||
sudo eopkg disable-repo Solus
|
||||
install_repo
|
||||
fi
|
||||
fi
|
||||
|
||||
# Upgrade
|
||||
sudo eopkg up
|
||||
# Install all previously installed packages.
|
||||
sudo eopkg install $(cat ${FILE})
|
||||
|
||||
echo "Package restore complete"
|
||||
Loading…
Add table
Add a link
Reference in a new issue