Useful Arch Linux Script Vault
This isualsv
.a script that can apply patches to files, or restore them to their original state if necessary.
Execute./ualsv.sh help
for more information
Do not forget executeinstall -Dm755 checkutils.sh /usr/local/share/ualsv/checkutils.sh
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
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,eval
is used
You can also look at theexample
folder, which contains a script to turn off tearing on Intel embedded
Thecheck
function is executed BEFORE installing packages from the$packages
and$aur
arrays.
If you want to list all the commands that the secondcheckutils.sh
script provides, runsed -n 's/^\([^(]\+\)()\s{$/\1/p' checkutils.sh
You can also put files that are not related to patches in thefiles
folder. 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).
gawk
sed
coreutils
bash
wget
curl
git
grep
pacman
sudo
patch
yay (AUR)
isfe
:Checks if file$1
exists.
| Add. arguments:
($2):null
- redirect warning to /dev/null
isde
:Checks if directory$1
exists.
| Add. arguments:
($2):null
- redirect warning to /dev/null
isee
:Checks if -$1
$2
exists.
| Add. arguments:
($3):null
- redirect warning to /dev/null
grepfile
:grep pattern$1
from file$2
user_read
:Reads user variable$1
with prompt${@:2}
| Add. arguments: Run with variable
$YN=Y(or)N
to 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 asMKTEMPDIR
variable
rmtempd
:Removes a temporaru directory and unsetMKTEMPDIR
variable
exitcheck
:(see file)
install_service
:Installs file$1
to/etc/systemd/system
,or, if file exists, returns warning andreturn 1
remove_service
:Removes file$1
from/etc/systemd/system
enable_service
:Enables$1
usingsystemctl enable
| Add. arguments:
($2):--now
- executessystemctl enable --now
disable_service
:Disables$1
usingsystemctl disable
| Add. arguments:
($2):--now
- executessystemctl disable --now
redirect
:Redirects the contents of the variable$text
to the specified file($1)
| Add. arguments:
($2):sudo
- executessudo tee
instead 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$1
is 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 -R
with additional arguments (for examplens
), enter:ns
as the first argument. If in the first argument the first character is not:
,packages will be installed from1
to thelast
argument