-
-
Save suuhm/053f819b000bee4af922d66ff6c5d32e to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# Setting Up OpenWRT on a Virtual Machine with Proxmox | |
# Based on: https://community.bigbeartechworld.com/t/setting-up-openwrt-on-a-virtual-machine-with-proxmox/257 | |
# Set your wished version: | |
export VER="23.05" | |
export ARCH="amd64" | |
export INDEX_URL="https://images.linuxcontainers.org/images/openwrt/$VER/$ARCH/default" | |
#export BUILDDATE=$(date -d "yesterday" '+%Y%m%d') | |
export BUILDDATE=$(curl -sL $INDEX_URL | grep "<a href=" | sed -E 's/.*<a href="([^"]+)".*/\1/' | sort | tail -n 1 | tr -d \/) | |
export BD_URL="$INDEX_URL/$BUILDDATE" | |
echo; echo "[*] Setting Up OpenWRT Version $VER on a Virtual Machine with Proxmox" | |
echo "[*] Downloading by $BD_URL/ " | |
sleep 2 | |
wget $BD_URL/rootfs.tar.xz -O /var/lib/vz/template/cache/OpenWrt-$VER.tar.xz | |
# lvm disk: 1G - RAM 1G - CPU 1Core 64bit | |
# | |
pct create 202 /var/lib/vz/template/cache/OpenWrt-$VER.tar.xz --arch $ARCH --hostname OpenWrt-$VER --rootfs local-lvm:1 --memory 1024 --cores 1 --ostype unmanaged --unprivileged 1 | |
echo -e " | |
Add network on interface and setup network file via dhcp | |
(vi /etc/config/network): | |
config interface 'wrtb' | |
option type 'bridge' | |
option ifname 'eth0' | |
option proto 'dhcp' | |
" | |
exit 0; |
I created a new script that downloads the current, or snapshot from OpenWrt directly, and it allows you to specify all the options as prompts. Including the Interface/bridge for WAN, and LAN, Autodetect next available container ID, and even specify what IPv4 subnet you want to use. If you want to install the Snapshot version, it will even prompt you if you want it to auto install LuCi.
https://gist.github.com/jaminmc/7e786a8947746439f7b8a8e2726e629d
I created a new script that downloads the current, or snapshot from OpenWrt directly, and it allows you to specify all the options as prompts. Including the Interface/bridge for WAN, and LAN, Autodetect next available container ID, and even specify what IPv4 subnet you want to use. If you want to install the Snapshot version, it will even prompt you if you want it to auto install LuCi.
https://gist.github.com/jaminmc/7e786a8947746439f7b8a8e2726e629d
@rickicode script seems unable to download OpenWRT image:
Maybe just missing something like
wget $BD_URL/rootfs.tar.xz -O /var/lib/vz/template/cache/OpenWrt-$VER.tar.xz
?