souci avec tee
This commit is contained in:
parent
b46fb1af7a
commit
b5a865e84b
33
upsnapz.sh
33
upsnapz.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Time-stamp: <2025-03-10 06:39:12 nomad>
|
# Time-stamp: <2025-03-10 19:33:49 nomad>
|
||||||
|
|
||||||
# Michel Le Cocq <lecocq@ipgp.fr>
|
# Michel Le Cocq <lecocq@ipgp.fr>
|
||||||
# <nomad@neuronfarm.net>
|
# <nomad@neuronfarm.net>
|
||||||
@ -38,13 +38,24 @@ LOG_FILE=/root/upsnapz.log
|
|||||||
# - verfier que 'gh auth status' fonctionne avant de l'utiliser (auth)
|
# - verfier que 'gh auth status' fonctionne avant de l'utiliser (auth)
|
||||||
# - ameliorer l'integration de : apt full-upgrade
|
# - ameliorer l'integration de : apt full-upgrade
|
||||||
# la c'est un peu brouillon
|
# la c'est un peu brouillon
|
||||||
#
|
# - souci avec tee : desactivation temporaire le temps de trouver une alternative
|
||||||
|
# Configuration file '/etc/mime.types'
|
||||||
|
# ==> Modified (by you or by a script) since installation.
|
||||||
|
# ==> Package distributor has shipped an updated version.
|
||||||
|
# What would you like to do about it ? Your options are:
|
||||||
|
# Y or I : install the package maintainer's version
|
||||||
|
# N or O : keep your currently-installed version
|
||||||
|
# D : show the differences between the versions
|
||||||
|
# Z : start a shell to examine the situation
|
||||||
|
# The default action is to keep your current version.
|
||||||
|
# *** mime.types (Y/I/N/O/D/Z) [default=N] ?
|
||||||
|
# N
|
||||||
# +------------------------------------------------------------------------------------------------+
|
# +------------------------------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
function showsnap
|
function showsnap
|
||||||
{
|
{
|
||||||
zfs list -o name,used,usedbysnapshots -r zroot/ROOT -s creation | grep -v '^zroot/ROOT .*' > /tmp/upsnap.tmp
|
zfs list -o name,used,usedbysnapshots -r zroot/ROOT -s creation | grep -v '^zxroot/ROOT .*' > /tmp/upsnap.tmp
|
||||||
for line in $(cat /tmp/upsnap.tmp | grep zroot | cut -d' ' -f1)
|
for line in $(cat /tmp/upsnap.tmp | grep zroot | cut -d' ' -f1)
|
||||||
do
|
do
|
||||||
nbr=$(zfs list -H -t snapshot -r $line | wc -l)
|
nbr=$(zfs list -H -t snapshot -r $line | wc -l)
|
||||||
@ -269,8 +280,8 @@ function asksnap()
|
|||||||
then
|
then
|
||||||
snapname=$(date +%Y-%m-%d-%H%M%S)
|
snapname=$(date +%Y-%m-%d-%H%M%S)
|
||||||
sudo zfs snapshot $bootfs@$snapname
|
sudo zfs snapshot $bootfs@$snapname
|
||||||
date +%Y_%m_%d-%H:%M > $LOG_FILE
|
#sudo date +%Y_%m_%d-%H:%M > $LOG_FILE
|
||||||
zfs list -H -o name $bootfs@$snapname | tee -a $LOG_FILE
|
zfs list -H -o name $bootfs@$snapname # | tee -a $LOG_FILE
|
||||||
askpromote $snapname $bootfs
|
askpromote $snapname $bootfs
|
||||||
else
|
else
|
||||||
echo no
|
echo no
|
||||||
@ -298,8 +309,8 @@ function askupgrade()
|
|||||||
# else
|
# else
|
||||||
# ask for making a snapshot
|
# ask for making a snapshot
|
||||||
|
|
||||||
printf '\n%s\n' 'apt list --upgradable' | tee /tmp/upsnapz-upgradable
|
printf '\n%s\n' 'apt list --upgradable' #| tee /tmp/upsnapz-upgradable
|
||||||
apt list --upgradable | tee -a /tmp/upsnapz-upgradable
|
apt list --upgradable #| tee -a /tmp/upsnapz-upgradable
|
||||||
|
|
||||||
printf '\nUpgrade or not : [Y-n]'
|
printf '\nUpgrade or not : [Y-n]'
|
||||||
read answer
|
read answer
|
||||||
@ -315,16 +326,16 @@ function askupgrade()
|
|||||||
if [ $1 -eq 1 ]
|
if [ $1 -eq 1 ]
|
||||||
then
|
then
|
||||||
echo '\nAbove packages need full upgrade.\nRun full-upgrade :' \
|
echo '\nAbove packages need full upgrade.\nRun full-upgrade :' \
|
||||||
| tee -a /tmp/upsnapz-upgradable
|
# | tee -a /tmp/upsnapz-upgradable
|
||||||
sudo apt -y full-upgrade | tee -a /tmp/upsnapz-upgradable
|
sudo apt -y full-upgrade # | tee -a /tmp/upsnapz-upgradable
|
||||||
elif [ $1 -eq 0 ]
|
elif [ $1 -eq 0 ]
|
||||||
then
|
then
|
||||||
printf 'before upgrade : '
|
printf 'before upgrade : '
|
||||||
asksnap
|
asksnap
|
||||||
printf '%s\n' 'apt -y upgrade'
|
printf '%s\n' 'apt -y upgrade'
|
||||||
sudo apt -y upgrade | tee -a /tmp/upsnapz-upgradable
|
sudo apt -y upgrade # | tee -a /tmp/upsnapz-upgradable
|
||||||
fi
|
fi
|
||||||
sudo cat /tmp/upsnapz-upgradable >> $LOG_FILE
|
#sudo cat /tmp/upsnapz-upgradable >> $LOG_FILE
|
||||||
else
|
else
|
||||||
echo no
|
echo no
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user