Skip to content

BiteDasher/ualsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

74 Commits

Repository files navigation

ualsv

Useful Arch Linux Script Vault

What is it?

This isualsv.a script that can apply patches to files, or restore them to their original state if necessary.

How to use it?

Execute./ualsv.sh helpfor more information
Do not forget executeinstall -Dm755 checkutils.sh /usr/local/share/ualsv/checkutils.sh

Updates

Theualsv_dbrepository is available, from which all packages will now be downloaded. If you would like to post your patch, please send me a Merge Request

How/where to download scripts for this thing? How do I write my own?

I'm still thinking about where I should store and whether I should store the script files for this program at all. But as soon as I do, I will definitely report it here.And at the expense of writing your script, I will now show you one of the examples:

test
├── script
├── backup
├── framework
└── files
├── patch.conf
├── something.desktop
└── one.patch

desc= "test"
version= "1-1"
creator= "Artemii (BiteDasher)"
packages=('systemd')
aur=('git-git')
get=('git:-:https://github.com/exa/mple.get'
'curl:name_to_save:https://git.io/12345'
'wget:-:https://git.io/wow')
check() {
echo check
}
action() {
echo action
}
restore() {
echo restore commands
}
cleanup() {
:
}
restore_cleanup() {
rm -r /tmp/trashcan
}
/etc/backup.example
/etc/backup.folder
/etc/backup.symlink
possible_args=('1: "" |first_arg|first_other_arg' '2:second_arg')
print_help() {
cat <<EOF
msg echo this if needed
EOF
}
framework() {
echo $1 $2
}

Next,files.

patch.conf

+one.patch:/var/run/some/file
second.patch:$HOME/some/file

By adding a+to the beginning of the line, you specify that the patch should be overlaid usingsudo
In the field after the colon, you can usevariables,as well as various characters, such as~.For their escape,evalis used

You can also look at theexamplefolder, which contains a script to turn off tearing on Intel embedded

Recommendations:

Thecheckfunction is executed BEFORE installing packages from the$packagesand$aurarrays.
If you want to list all the commands that the secondcheckutils.shscript provides, runsed -n 's/^\([^(]\+\)()\s{$/\1/p' checkutils.sh
You can also put files that are not related to patches in thefilesfolder. For example, something additional that will be used later during the execution of the script
You can download only frameworks (without patches and script file).

Dependencies:

gawk
sed
coreutils
bash
wget
curl
git
grep
pacman
sudo
patch
yay (AUR)

Function scheme from filecheckutils.sh

isfe:Checks if file$1exists.
| Add. arguments:($2):null- redirect warning to /dev/null

isde:Checks if directory$1exists.
| Add. arguments:($2):null- redirect warning to /dev/null

isee:Checks if -$1$2exists.
| Add. arguments:($3):null- redirect warning to /dev/null

grepfile:grep pattern$1from file$2

user_read:Reads user variable$1with prompt${@:2}
| Add. arguments: Run with variable$YN=Y(or)Nto ask a question and give the user an answer

out:echo ===> $*

die:echo (die function) and exit 1

warning:echo yellow ===> and WARNING: $*

smallw:echo yellow -> and $*

msg:echo bold cyan >>> and $*

msg2:echo -> and $*

error:echo red ===> and ERROR: $*

success:echo green ---> and $*

process:echo \t(tab) and $*

sendnull:Execute command with redirection &>/dev/null

mktempd:Creates a temporary directory withmktemp -d,then exports it asMKTEMPDIRvariable

rmtempd:Removes a temporaru directory and unsetMKTEMPDIRvariable

exitcheck:(see file)

install_service:Installs file$1to/etc/systemd/system,or, if file exists, returns warning andreturn 1

remove_service:Removes file$1from/etc/systemd/system

enable_service:Enables$1usingsystemctl enable
| Add. arguments:($2):--now- executessystemctl enable --now

disable_service:Disables$1usingsystemctl disable
| Add. arguments:($2):--now- executessystemctl disable --now

redirect:Redirects the contents of the variable$textto the specified file($1)
| Add. arguments:($2):sudo- executessudo teeinstead oftee

redirect_a:likeredirect,buttee -a

cat_redirect:likeredirect,but readsstdout

cat_redirect_a:likecat_redirect,buttee -a

dline:sed "/$1/d" -i "$2"
| Add. arguments:($3):sudo- executes as sudo

dlinex:sed "/^$1\$/d" -i "$2"
| Add. arguments:($3):sudo- executes as sudo

ialine:sed "/$1/a $2" -i "$3"
| Add. arguments:($4):sudo- executes as sudo

ibline:sed "/$1/i $2" -i "$3"
| Add. arguments:($4):sudo- executes as sudo

ibetween:sed -e "/$1/,/$2/c\\$1\n$3\n$2" -i "$4"
| Add. arguments:($5):sudo- executes as sudo

cline:sed -e "/$1/ s/$2/$3/" -i "$4"
| Add. arguments:($5):sudo- executes as sudo

ispe:Checks if package$1is installed locally
| Add. arguments:($2):null- redirect warning to /dev/null

instpkg:Installs packages$@

instaur:Installs packages$@usingyay

rmpkg:Removes packages$@
| Add. arguments:($1)- If you want to runpacman -Rwith additional arguments (for examplens), enter:nsas the first argument. If in the first argument the first character is not:,packages will be installed from1to thelastargument