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

View File

@ -1,5 +1,6 @@
#!/bin/bash #!/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; } 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 while getopts "n:u:i:s:" option
@ -8,12 +9,14 @@ do
in in
n)name=${OPTARG};; n)name=${OPTARG};;
u)upgrade="yes";; u)upgrade="yes";;
i)install=${OPTARG};; i)packages+=("$OPTARG");;
s)squashfs=${OPTARG};; s)squashfs=${OPTARG};;
*)usage;; *)usage;;
esac esac
done done
shift $((OPTIND -1))
echo "Pakiety: ${packages[@]}"
echo "$squashfs" echo "$squashfs"
sudo unsquashfs -d /tmp/squashfs $squashfs sudo unsquashfs -d /tmp/squashfs $squashfs
sudo mount --bind /dev/pts /tmp/squashfs/dev/pts 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 if [ -n "$upgrade" ]; then
sudo chroot /tmp/squashfs/ /bin/bash -c 'DEBIAN_FRONTEND=noninteractive apt upgrade -y' sudo chroot /tmp/squashfs/ /bin/bash -c 'DEBIAN_FRONTEND=noninteractive apt upgrade -y'
fi fi
if [ -n "$install" ]; then if [ -n "$packages" ]; then
sudo chroot /tmp/squashfs/ /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt install $install -y" sudo chroot /tmp/squashfs/ /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt install ${packages[@]} -y"
fi fi
sudo chroot /tmp/squashfs/ /bin/bash -c 'apt clean all' sudo chroot /tmp/squashfs/ /bin/bash -c 'apt clean all'
sudo umount /tmp/squashfs/dev/pts sudo umount /tmp/squashfs/dev/pts
sudo umount /tmp/squashfs/proc sudo umount /tmp/squashfs/proc
sudo rm -rf $name.squashfs 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 sudo rm -rf /tmp/squashfs