Skip to content

Instantly share code, notes, and snippets.

@coffnix
Last active December 22, 2018 07:21
Show Gist options
  • Save coffnix/345fbaddf61e4312caa244f022ea6047 to your computer and use it in GitHub Desktop.
Save coffnix/345fbaddf61e4312caa244f022ea6047 to your computer and use it in GitHub Desktop.
GEN image raspi3b+ funtoo linux Raw
# descompacte no sdcard novo:
mkdir /pendrive;mount /dev/mmcblk0p2 /pendrive/;mount /dev/mmcblk0p1 /pendrive/boot
tar xjpf funtoo-raspi3-22-12-2018.tar.bz2 -C /pendrive
# troca senha pra root
sed -i /'root:'/d /pendrive/etc/shadow
sed -i '1i root:$6$RmC.Jho1o/9n/.7X$aMOtiIZC3hoLaJJJ3ZW2Do7IRlSMuDWh5qUvaG9beIIFO92kWYJmrxAARypJA/g3zj4/wbq7rumQorw6lOMTE.:17846:0:::::' /pendrive/etc/shadow
# recover permission
cp /pendrive/perms.acl / ; cd / ; setfacl --restore=perms.acl
# crie a swap de 1GB do raspi3bplus
dd if=/dev/zero of=/pendrive/swapfile.swp bs=1k count=1024k
chmod 600 /pendrive/swapfile.swp
mkswap /pendrive/swapfile.swp
sync
cd ; umount /pendrive/boot /pendrive
# ative após o primeiro boot no rasp e reboote
for service in dhcpd openvpn fail2ban firewall zabbix-proxy zabbix-agentd postgresql-10;do rc-update add $service ;done ; ego sync ; reboot
# desative antes de desligar o rasp
for service in dhcpd openvpn fail2ban firewall zabbix-proxy zabbix-agentd postgresql-10;do rc-update del $service ;done
###################################3
# monte o sdcard
mkdir /pendrive;mount /dev/mmcblk0p2 /pendrive/;mount /dev/mmcblk0p1 /pendrive/boot
# gere a imagem
cd /pendrive ; tar cjpf /raspi3bplus-funtoo1-3.tar.bz2 --exclude "proc/*" --exclude "var/cache/portage/distfiles/*" --exclude "var/tmp/portage/*" --exclude "root/.ssh/*" --exclude "etc/ssh/*pub" --exclude "" --exclude "etc/ssh/*key " --exclude "var/git/*" --exclude "root/.lesshst" --exclude "root/.Xauthority" --exclude "root/.ICEauthority" --exclude "root/.viminfo" --exclude "root/.gitconfig" --exclude "root/.bash_history" --exclude "root/.wget-hsts" --exclude "opt/firmware-nonfree" --exclude "" --exclude "opt/firmware" --exclude "opt/userland" --exclude "etc/ori-fail2ban" --exclude "etc/openvpn/*" --exclude "etc/zabbix/*" --exclude "var/lib/postgresql/10/data/*" --exclude "var/log/*.log" --exclude "var/log/messages" --exclude "var/log/lastlog" --exclude "var/log/wtmp*" --exclude "var/log/dmesg" --exclude "var/log/named/*" --exclude "var/log/ConsoleKit/*" --exclude "var/log/zabbix/*" --exclude "var/log/named/*" --exclude "swapfile.swp" * ; ls -lh /raspi3bplus-funtoo1-3.tar.bz2
cd ; umount /pendrive/boot /pendrive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment