bug i uaktualnienie skryptu aktualizujacego

This commit is contained in:
Mateusz779 2023-04-21 10:11:58 +02:00
parent 7297474469
commit 135eb3b32b
2 changed files with 8 additions and 5 deletions

View File

@ -86,7 +86,7 @@
</div>
<script>
function ssh(ipvpn, iplocal username, password) {
function ssh(ipvpn, iplocal, username, password) {
const currentLocation = window.location;
let ip = ipvpn != null ? ipvpn : iplocal;
const newUrl = currentLocation.protocol + '//' + currentLocation.hostname + ':' + {{ ssh_port }} + "/?hostname="+ip+"&username="+username+"&password="+btoa(password);

View File

@ -1,5 +1,6 @@
#!/bin/bash
echo "Parametry podane do skryptu: $@"
usage() { echo "Usage: [ -n <nazwa obrazu>] [ -s <obraz zródłowy>] [-u <yes - upgrade>] [-i <pakiety do instalacji>]" 1>&2; exit 1; }
while getopts "n:u:i:s:" option
@ -8,12 +9,14 @@ do
in
n)name=${OPTARG};;
u)upgrade="yes";;
i)install=${OPTARG};;
i)packages+=("$OPTARG");;
s)squashfs=${OPTARG};;
*)usage;;
esac
done
shift $((OPTIND -1))
echo "Pakiety: ${packages[@]}"
echo "$squashfs"
sudo unsquashfs -d /tmp/squashfs $squashfs
sudo mount --bind /dev/pts /tmp/squashfs/dev/pts
@ -26,13 +29,13 @@ sudo chroot /tmp/squashfs/ /bin/bash -c 'apt update'
if [ -n "$upgrade" ]; then
sudo chroot /tmp/squashfs/ /bin/bash -c 'DEBIAN_FRONTEND=noninteractive apt upgrade -y'
fi
if [ -n "$install" ]; then
sudo chroot /tmp/squashfs/ /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt install $install -y"
if [ -n "$packages" ]; then
sudo chroot /tmp/squashfs/ /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt install ${packages[@]} -y"
fi
sudo chroot /tmp/squashfs/ /bin/bash -c 'apt clean all'
sudo umount /tmp/squashfs/dev/pts
sudo umount /tmp/squashfs/proc
sudo rm -rf $name.squashfs
sudo mksquashfs /tmp/squashfs/ $name.squashfs -b 1048576 -comp xz -Xdict-size 100%
sudo mksquashfs /tmp/squashfs/ $name.squashfs -noappend -b 1048576 -comp xz -Xdict-size 100%
sudo rm -rf /tmp/squashfs