You are not logged in.
If there are older pacnew files there might be a good reason for it.
Hopefully the good reason does not imply the importance of the file.pacnew's content.
Because, as far as I know, older pacnew's should be simply overwritten by newer ones.
Last edited by respiranto (2015-07-16 10:04:08)
Offline
The good reason is usually that I really need to redo the config because the old is justs chaotic, the new ships with new options that look interesting (like mpd does occasionally) and/or I've no idea what I did there a couple of years ago. So it's great to have the pacnew file there as a reminder.
Offline
Because, as far as I know, older pacnew's should be simply overwritten by newer ones.
This is not always the case.
Matt
"It is very difficult to educate the educated."
Offline
respiranto wrote:Because, as far as I know, older pacnew's should be simply overwritten by newer ones.
This is not always the case.
In what instance would it not be the case?
Offline
mirrorlist comes to mind. Also grub.cfg if you maintain your own instead of using the horrid one grub-mkconfig generates.
Last edited by Earnestly (2015-07-17 12:27:45)
Offline
I think you are talking about two different things here. Nobody was claiming that a config file should be blindly replaced by the pacnew. It was that, one unmerged pacnew would be replaced by a newer pacnew file should an update result in one.
Offline
New password shadows, etc. They need some hands-on attention sometimes. New config files that have been modified, etc. (Journal config, for example.)
Matt
"It is very difficult to educate the educated."
Offline
A function to print connman credentials:
passes(){
awk -F= '
/^Name/ && !/Wired/ {printf "%s: ",$2};
/^Pass/ {for(i=2;i<=NF;i++){printf "%s%s",(i>2?" ":""), $i} printf "\n"}
' /var/lib/connman/*/settings
}
Offline
I installed again arch before two days and I'm using budgie desktop and I wanted a light way to automatic change background. I know that there are some scripts already, but I'd like solid color backgrounds instead of images. So I wrote this script to automatic change to color of desktop and lock screen background every minute:
#/bin/bash
COLORS=("\"#0f2030\"" "\"#4a6159\"" "\"#2e0000\"" "\"#123644\"" "\"#203339\"" "\"#405163\"" "\"#748280"\"" "\"#07473F"\"" "\"#007CC3"\"" "\"#004A75"\"" "\"#565B63"\"" "\"#301515"\"")
echo $COLORS
cLen=${#COLORS[@]}
echo $cLen
while true
do
es=${COLORS[$((RANDOM%$cLen-1))]}
dconf write /org/gnome/desktop/background/primary-color $es
dconf write /org/gnome/desktop/background/secondary-color $es
dconf write /org/gnome/desktop/screensaver/primary-color $es
dconf write /org/gnome/desktop/screensaver/secondary-color $es
sleep 60
done
Offline
when i open the console, for auto teach one command from man
man -k $(ls /usr/share/man/man[1-8]/*.gz | cut -d "." -f1 | cut -d "/" -f6 | shuf | head -n 1)
or only in your language (fr):
man -k $(ls /usr/share/man/fr/man[1-8]/*.gz | cut -d "." -f1 | cut -d "/" -f7 | shuf | head -n 1)
EDIT: thanks karol
man -k $(find /usr/share/man/man[1-8]/ -not -name '*_*' -not -name '*::*' -printf "%f\n" |shuf -n 1|cut -d. -f1) |head -n 1
Last edited by papajoke (2015-07-28 00:02:33)
lts - zsh - Kde - Intel Core i3 - 6Go RAM - GeForce 405 video-nouveau
Offline
when i open the console, for auto teach one command from man
man -k $(ls /usr/share/man/man[1-8]/*.gz | cut -d "." -f1 | cut -d "/" -f6 | shuf | head -n 1)
or only in your language (fr):
man -k $(ls /usr/share/man/fr/man[1-8]/*.gz | cut -d "." -f1 | cut -d "/" -f7 | shuf | head -n 1)
http://mywiki.wooledge.org/ParsingLs
$ man -k $(find /usr/share/man/man[1-8] -printf "%f\n" | shuf -n 1 | cut -d. -f1)
fdatasync (2) - synchronize a file's in-core state with storage device
fdatasync (3p) - synchronize the data of a file (REALTIME)
$ man -k $(find /usr/share/man/man[1-8] -printf "%f\n" | shuf -n 1 | cut -d. -f1)
iso-8859-10 (7) - ISO 8859-10 character set encoded in octal, decimal, and hexadecimal
$ man -k $(find /usr/share/man/man[1-8] -printf "%f\n" | shuf -n 1 | cut -d. -f1)
pango-view (1) - Pango text viewer
Offline
Poor user's dynamic IP domain management with ssmtp:
E-mail your public IP address to user@domain.ext
#!/bin/bash
wget -qO- http://ipecho.net/plain | mail -s "$HOSTNAME woke up!" user@domain.ext
TODO: encrypt the address, ipv6?
NOTE: Remember, in a home or office network, the public IP address belongs to the router; make sure ports are open or forwarded, hope you don't have to deal with NAT, etc.
Systemd service to do this at boot:
[Unit]
Description=ip-drop
After=systemd-networkd-wait-online.service
Wants=systemd-networkd-wait-online.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bash "/usr/local/sbin/ip-drop"
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target
TODO: trigger on any DHCP cycle (how to detect from behind a router?)
NOTE: *-wait-online services are likely to increase boot time.
I configured my router to forward SSH so I can access my home PC from wherever + installed mpd from a cellphone, on a bus .
Last edited by quequotion (2017-12-22 02:31:45)
makepkg-optimize · indicator-powersave · pantheon-{3d,lite} · {pantheon,higan}-qq
Offline
Hi
Thought id post this handy wee function i use, in time for the soccer season starting, it shows realtime soccer results from around the world, im no programmer so any fixes, enhancements would be very welcome.
function score() {
watch -n10 --no-title "w3m http://www.livescores.com/ |awk '/live [0-9H]+[^ ]/,/red cards/'"
}
regards
Last edited by cirrus (2016-12-04 21:36:30)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
.
Last edited by yuannan (2023-01-06 04:34:39)
Offline
See https://wiki.archlinux.org/index.php/Fo … s_and_code
I actully didn't know that you just "w!" or "wq!" in vim
Why not
map ss :w !sudo tee % > /dev/null<CR
I don't think ':wq!' helps here.
Last edited by karol (2015-08-12 23:54:57)
Offline
And if you set write permission for your user, why do you then edit it with vim with sudo? The whole permission changing becomes irrelevant then.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I call this "znap-update" and is my new way of updating my machine since I moved to btrfs recently:
#!/usr/bin/bash
# Variables for pacmatic
export DIFFPROG="meld"
export DIFFSEARCHPATH="/boot /etc /usr"
# No prompt for set -x
PS4=""
# If enabled, the following lines log output but also make it less interactive:
# Redirect stdout ( > ) into a named pipe ( >() ) running "tee"
#exec > >(tee -i /var/log/znap-update.log)
# Also log errors
#exec 2>&1
echo -e "znap-update begin at:" $(date)
echo -e "\nFinding a fast mirror:"
(set -x; reflector --verbose -l 10 -p http --sort rate --save /etc/pacman.d/mirrorlist)
echo -e "\nCleaning old packages:"
(set -x; pacman -Sc --color always)
echo -e "\nUpdate pkgfile:"
(set -x; pkgfile --update)
echo -e "\nUpdate abs:"
(set -x; abs)
echo -e "\nMounting .snapshots:"
(set -x; mount /.snapshots)
echo -e "Delete old temporary snapshot if not already deleted, error if already deleted:"
(set -x; btrfs subvolume delete -C /.snapshots/snapshot_root_update_new)
echo -e "Make new (temporary) snapshot:"
(set -x; btrfs subvolume snapshot / /.snapshots/snapshot_root_update_new)
if [ $? -ne 0 ]; then
echo -e "\nERROR while creating new snapshot, exiting!"
(set -x; umount /.snapshots)
(set -x; sync)
date
exit
fi
echo -e "\nUpdate all official packages:"
(set -x; pacmatic -Syu --color always)
echo -e "\nYaourt update of AUR packages as $SUDO_USER:"
(set -x; sudo -u $SUDO_USER yaourt -Syua --color)
echo -e "\nTrying to remove no longer needed packages, error if no deprecated packaged are found:"
(set -x; pacman -Rns $(pacman -Qdtq) --color always)
echo -e "\nLocal packages:"
(set -x; yaourt -Qma --color | grep "local/")
echo -e "\n"
read -p "Do you want to keep the snapshot made before the upgrade? <Y/n> " prompt
echo -e "\n"
if [[ $prompt == "n" || $prompt == "N" || $prompt == "no" || $prompt == "No" || $prompt == "NO" ]]
then
(set -x; btrfs subvolume delete -C /.snapshots/snapshot_root_update_new)
else
(set -x; btrfs subvolume delete -C /.snapshots/snapshot_root_update_3)
(set -x; mv /.snapshots/snapshot_root_update_2 /.snapshots/snapshot_root_update_3)
(set -x; mv /.snapshots/snapshot_root_update_1 /.snapshots/snapshot_root_update_2)
(set -x; mv /.snapshots/snapshot_root_update_new /.snapshots/snapshot_root_update_1)
fi
echo -e "\n"
(set -x; btrfs subvolume list -a -t --sort=-gen /)
echo -e "\n"
(set -x; umount /.snapshots)
(set -x; sync)
#echo -e "\nOutput was logged at /var/log/znap-update.log, znap-update ended at:" $(date)
echo -e "\nznap-update ended at:" $(date)
Before this I was only using one long line that did everything else except the snapshot part.
I am still not sure if I should keep 3 or more snapshots... I will see in time depending on how much space they will use.
It is meant to be run with sudo from an x terminal.
I also have two simple scripts that make snapshots one before login (called by systemd) and one every day (called by anacron), they are identicaly except one has the word "daily" and one has the word "login" so I will only paste one of them:
#!/usr/bin/bash
# Redirect stdout ( > ) into a named pipe ( >() ) running "tee"
exec > >(tee /var/log/znap-daily.log)
# log errors
exec 2>&1
echo -e "znap-daily begin at:" $(date)
echo -e "\nMounting .snapshots:"
mount /.snapshots
echo -e "Delete old temporary daily snapshot if not already deleted, error if already deleted:"
btrfs subvolume delete -C /.snapshots/snapshot_root_daily_new
echo -e "Make new (temporary) snapshot:"
btrfs subvolume snapshot / /.snapshots/snapshot_root_daily_new
if [ $? -ne 0 ]; then
echo -e "\nERROR while creating new snapshot, exiting!"
umount /.snapshots
sync
date
exit
fi
echo -e "Delete old daily snapshot, error if already deleted:"
btrfs subvolume delete -C /.snapshots/snapshot_root_daily
echo -e "Renaming temporary daily snapshot as .snapshots/snapshot_root_daily:"
mv /.snapshots/snapshot_root_daily_new /.snapshots/snapshot_root_daily
echo -e "\n"
btrfs subvolume list -a -t --sort=-gen /
umount /.snapshots
sync
echo -e "\nznap-daily done at:" $(date)
I first made one single more complex script called "znap" that used parameters for more than what the existing scripts do but it became to complex and it kind of reinvented the wheel (it functions just to make, list or delete a snapshot for example) so I preferred this much simpler and primitive scripts because they are much more maintainable.
I didn't use snapper because it is to much for my needs.
This is how my btrfs subvolumes look right now, in time I might add more subvolumes for stuff that don't need to be included in snapshots:
btrfs subvolume list -a -t --sort=-gen /
ID gen top level path
-- --- --------- ----
257 74728 5 <FS_TREE>/subvolume_root
258 74720 5 <FS_TREE>/subvolume_snapshots
1053 74718 258 <FS_TREE>/subvolume_snapshots/snapshot_root_login
327 74662 5 <FS_TREE>/subvolume_pkg
1007 74662 258 <FS_TREE>/subvolume_snapshots/snapshot_root_update_1
326 74646 5 <FS_TREE>/subvolume_abs
1005 74645 258 <FS_TREE>/subvolume_snapshots/snapshot_root_update_2
727 74644 5 <FS_TREE>/subvolume_pkgfile
1002 74623 258 <FS_TREE>/subvolume_snapshots/snapshot_root_update_3
1001 74620 258 <FS_TREE>/subvolume_snapshots/snapshot_root_daily
262 74092 257 subvolume_root/var/lib/machines
Offline
^Why are you spawning a subshell with `set -x` everytime you want to run an external command?
Offline
^Why are you spawning a subshell with `set -x` everytime you want to run an external command?
Because I wanted to display most of the commands but not everything, for example I wanted to not display if then.
If I put set -x at beginning and then set +x and then again set -x it displays the "set +x" so I used one subshell for each command I wanted to display.
I could have used fewer subshells and group commands but I let them like this for formatting reasons, it looked more clear to me this way.
So TL;DR: For formatting.
Offline
I don't know if this is a sane thing to do but why doesn't pacman do the following
if [ -e /var/lib/pacman/db.lck ]; then
if [ pidof pacman ]; then
echo pacman already busy
else rm -rf /var/lib/pacman/db.lck
fi
EDIT:
oh, right. it'll catch itself, but a wrapper could do this
Last edited by hawkinstw (2015-08-23 06:19:53)
Offline
hawkinstw, how often do you need to delete the lock file?? If you ever have to delete it it is because something has gone wrong. If you regularly have to delete it, then something is very wrong. Don't just clear away the symptom, find the problem. In several years of using archlinux I think I've only needed to delete a pacman lock file once, and that was due to a power outage during an upgrade.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Trilby, Here in South Africa we have loadshedding, meaning some weeks we have 2 or 4 hours of power failure per day. Chances are very good for it happening during an upgrade if you have 10 or more archlinux systems
Offline
Ah, in that case it makes sense. It just seemed a symptom of a deeper problem ... and there is a deeper problem, but one that is out of your control.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
create playcount histograms from files generated by mpdscribble's file backend:
*update* use gettops
carnager@caprica ~ > localfm "Pearl Jam" --album --lines 10
Most track plays (albums) for artist "Pearl Jam":
Pearl Jam - Vs. |133 (13.68%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Vitalogy |127 (13.07%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Backspacer |96 (9.88%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Lightning Bolt |70 (7.20%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Precious And Beautiful|66 (6.79%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - No Code |60 (6.17%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Ten |58 (5.97%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Pearl Jam |54 (5.56%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Binaural |40 (4.12%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
carnager@caprica ~ > localfm "Pearl Jam" --lines 10
Most played tracks by artist "Pearl Jam":
Pearl Jam - Rearviewmirror |19 (1.95%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Porch |16 (1.65%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Daughter |15 (1.54%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - State of Love and Trust |15 (1.54%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Elderly Woman Behind the Counter in a Small Town|14 (1.44%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - The Fixer |14 (1.44%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Animal |13 (1.34%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Breath |13 (1.34%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Last Exit |12 (1.23%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Pearl Jam - Better Man |12 (1.23%) ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
And the script, uses the excellent distribution
#!/bin/bash
main () {
stuff=$(grep -i "$name" mpd-formatted-tracks.txt |awk '{first = $1; $1 = ""; print $0 }' | sort | uniq -c)
if [[ -n $album ]]; then
if [[ -z $name ]]; then exit; fi
rm -f /tmp/list
echo "${stuff}" | sort | while read line; do
plays=$(echo "$line" | awk -F ' ' '{ print $1 }')
split=$(echo "$line" | awk '{first = $1; $1 = ""; print $0}' | cut -c 2-)
artist=$(echo "$split" | awk -F ' - ' '{ print $1 }')
title=$(echo "$split" | awk -F ' - ' '{ print $2 }')
echo -e "${plays} $(mpc search --format '%artist% - %title% - %album%' artist "${artist}" title "${title}" | head -1)" >> /tmp/list
done
echo -e "Most track plays (albums) for artist \"${name}\":\n"
cat /tmp/list | awk -F ' - ' '{ print $1,"-",$3 }' | distribution -g --height=$lines --size=full --char=$char --width=100 ${color} 2>/dev/null | grep -vE "^-"
else
echo "${stuff}" | sort | distribution -g --height=$lines --size=full --char=$char --width=100 ${color} 2>/dev/null
fi
}
printHelp () {
cat << EOF
local.fm
Usage: ${0##*/} [-sa] [-c CHARACTER] [-l LINES] [-n KEYWORD]
-n "keyword" keyword (mandatory)
-s colorize output
-a print album stats
-c "foo" use character "foo" for histogram
-l "int" print "int" lines
EOF
}
OPTIND=1
while getopts "hasn:l:c:" opt; do
case "$opt" in
h)
printHelp
exit 0
;;
n)
name=$OPTARG
;;
a)
album=true
;;
l)
lines=$OPTARG
;;
c)
char=$OPTARG
;;
s)
color="--color"
;;
esac
done
shift "$((OPTIND-1))"
main
Album stats generation far too slow, which is why i had to disable it without specified artist.
Hopefully someone has interest in this and makes it fast
Last edited by Rasi (2015-08-25 23:48:58)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
...you know, getopts is a thing.
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline