mklni: Add update
This commit is contained in:
parent
d8b2eb7f19
commit
e209d0d746
39
mklni
39
mklni
|
@ -70,12 +70,17 @@ arguments() {
|
|||
chroot_into
|
||||
break 2 ;;
|
||||
|
||||
update)
|
||||
update
|
||||
break 2 ;;
|
||||
|
||||
-r | -c | --cleanraw | --cleanup)
|
||||
run_makelni "$opt"
|
||||
break ;;
|
||||
break 2 ;;
|
||||
|
||||
-h | -help | --help)
|
||||
usage ;;
|
||||
usage
|
||||
break 2 ;;
|
||||
|
||||
*)
|
||||
log "Unknown option: $opt" error
|
||||
|
@ -318,6 +323,7 @@ build()
|
|||
|
||||
cp "$lni" "$CHROOTDIR/tmp/lnibuild"
|
||||
|
||||
log "Entering build chroot"
|
||||
prepare_chroot || {
|
||||
log "Failed to setup chroot" error
|
||||
exit 1
|
||||
|
@ -327,6 +333,7 @@ build()
|
|||
local exitcode=$?
|
||||
rm "$CHROOTDIR/tmp/lnibuild"
|
||||
|
||||
log "Exiting build chroot"
|
||||
detach_chroot || {
|
||||
log "Failed to detach chroot" error
|
||||
exit 1
|
||||
|
@ -372,6 +379,34 @@ run_makelni()
|
|||
return "$exitcode"
|
||||
}
|
||||
|
||||
update()
|
||||
{
|
||||
[ ! -d "$CHROOTDIR" ] && {
|
||||
log "Chroot not installed" error
|
||||
exit 1
|
||||
}
|
||||
|
||||
prepare_chroot || {
|
||||
log "Failed to setup chroot" error
|
||||
exit 1
|
||||
}
|
||||
|
||||
log "Updating makelni"
|
||||
chroot "$CHROOTDIR" /bin/bash -c "cd /makelni && git pull"
|
||||
local exitcode=$?
|
||||
|
||||
detach_chroot || {
|
||||
log "Failed to detach chroot" error
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "$exitcode" -eq "0" ] || {
|
||||
log "Failed to update makelni" error
|
||||
}
|
||||
|
||||
return "$exitcode"
|
||||
}
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
log "$0 must be run as root"
|
||||
exit 3
|
||||
|
|
Loading…
Reference in a new issue