Created
April 30, 2021 03:23
-
-
Save hoefkensj/b3e9eb9e5444e92733de1cfbde799c12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default ignored files | |
/shelf/ | |
/workspace.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="ProjectCodeStyleConfiguration"> | |
<state> | |
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> | |
</state> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="DiscordProjectSettings"> | |
<option name="show" value="PROJECT_FILES" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="jdk" jdkName="Python 3.9 (2)" jdkType="Python SDK" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
<orderEntry type="module" module-name="pythonProject" /> | |
<orderEntry type="module" module-name="python" /> | |
<orderEntry type="module" module-name="mortagecfg" /> | |
<orderEntry type="module" module-name="flaggie-master" /> | |
<orderEntry type="module" module-name="makeportagecfg" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<profile version="1.0"> | |
<option name="myName" value="Project Default" /> | |
<inspection_tool class="PyPep8Inspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> | |
<inspection_tool class="PyPep8NamingInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" /> | |
<inspection_tool class="PyStubPackagesCompatibilityInspection" enabled="false" level="WARNING" enabled_by_default="false" /> | |
</profile> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (2)" project-jdk-type="Python SDK" /> | |
<component name="PyPackaging"> | |
<option name="earlyReleasesAsUpgrades" value="true" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/GentooInstaller.iml" filepath="$PROJECT_DIR$/.idea/GentooInstaller.iml" /> | |
<module fileurl="file://$USER_HOME$/GIT-REPO/flaggie-master/.idea/flaggie-master.iml" filepath="$USER_HOME$/GIT-REPO/flaggie-master/.idea/flaggie-master.iml" /> | |
<module fileurl="file://$PROJECT_DIR$/../makeportagecfg/.idea/makeportagecfg.iml" filepath="$PROJECT_DIR$/../makeportagecfg/.idea/makeportagecfg.iml" /> | |
<module fileurl="file://$PROJECT_DIR$/../mortagecfg/.idea/mortagecfg.iml" filepath="$PROJECT_DIR$/../mortagecfg/.idea/mortagecfg.iml" /> | |
<module fileurl="file://$USER_HOME$/F:/python/.idea/python.iml" filepath="$USER_HOME$/F:/python/.idea/python.iml" /> | |
<module fileurl="file://$PROJECT_DIR$/../pythonProject/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/../pythonProject/.idea/pythonProject.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="PylintConfigService"> | |
<option name="customPylintPath" value="C:\Python27\Scripts\pylint.exe" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import shlex | |
from pynput import keyboard | |
from sys import stdout | |
def supersu(dummy): | |
superuser=run('echo', dummy) | |
def run(cmd, args=''): | |
args = f'-S {cmd} {args}' | |
su = 'sudo' | |
bashline = [su] + shlex.split(args) | |
allput = ['stdout:\n'] | |
process = subprocess.Popen(bashline, stdout=subprocess.PIPE, universal_newlines=True) | |
ret = {'RETURN_CODE' : '','STDOUT': ''} | |
while True: | |
output = process.stdout.readline() | |
wrep(output.strip()) | |
allput.append(output.strip()) | |
# Do something else | |
return_code = process.poll() | |
if return_code is not None: | |
ret['RETURN_CODE']= return_code | |
#wrep(f'RETURN CODE:{return_code}') | |
# Process has finished, read rest of the output | |
for output in process.stdout.readlines(): | |
wrep(output.strip()) | |
allput.append(output.strip()) | |
break | |
ret['STDOUT']= allput | |
return ret | |
def ask(Q): | |
looped=0 | |
loop = 1 | |
wnln(Q) | |
while True : | |
with keyboard.Events() as events: | |
# Block for as much as possible | |
event=events.get(1e6) | |
if event.key == keyboard.KeyCode.from_char('y') or event.key == keyboard.Key.enter : | |
wrep("YES") | |
A=True | |
break | |
if event.key == keyboard.KeyCode.from_char('n'): | |
wrep("NO:") | |
A=False | |
break | |
else: | |
wnln("\n") | |
wrep(f"no valid key detected use y [default] for YES , n for NO , [enter] for default") | |
continue | |
break | |
return A | |
def umount(file,path,args): | |
STAT= run('umount', f'{file}') | |
if STAT['RETURN_CODE'] != 0: | |
wnln('SOMETHING FUCKED UP! : PROCESS RETURNED CODE:', STAT['RETURN_CODE']) | |
wnln('OUTPUT:\n\n') | |
wnln(STAT['STDOUT']) | |
quit() | |
else: | |
wrep(f"{path} : UNMOUNTED\t\t\t[V]\n") | |
def mount(file,path,args): | |
if ask(f"mount [{file}] on [{path.lower()}] ? [Y]/n") == True: | |
wnxt(f'Mounting [{file}] on [{path.lower()}] ... ') | |
STAT=run('mount',f'{args} {file} {path.lower()}') | |
if STAT['RETURN_CODE'] != 0: | |
wnln(f"SOMETHING FUCKED UP! : PROCESS RETURNED CODE:'{STAT['RETURN_CODE']}") | |
wnln('OUTPUT:\n\n') | |
wnln(STAT['STDOUT']) | |
quit() | |
else: | |
wrep(f"{path} : MOUNTED\t\t\t[V]\n") | |
def make_rslave(path): | |
print(f'making [{path.lower()}] an rslave... ') | |
run('mount', f'--make-rslave {path.lower()}') | |
def wnxt(line): | |
stdout.write(f'\t{line}') | |
def wrep(line): | |
stdout.write('\r{txt}'.format(txt=line)) | |
def wnln(line): | |
stdout.write('\n{txt}'.format(txt=line)) | |
def main(cmd, args=''): | |
return run(cmd, args) | |
if __name__ == '__main__': | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISK='nvme0n1' | |
CFG_MAKE='/dev/portage/make.conf' | |
CFG_PWQC='/etc/security/passwdqc.conf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def spawn(file_name): | |
with open(f'{file_name}.ini' , 'w') as file: | |
file.write(f'[DEFAULT]\nfilename\t:\t{file_name}\nfiletype\t:\tini') | |
def create(file_Config,dct_Config, cfg_config): | |
cfg= tocfg(dct_Config, cfg_config) | |
write(file_Config, cfg) | |
def read(file_Config, cfg_Config): | |
cfg_Config.read(file_Config) | |
return cfg_Config | |
def todct(cfg,dct={}): | |
for section in cfg.keys(): | |
dct[section]= dict(cfg[section]) | |
return dct | |
def tocfg(dct,cfg): | |
cfg.read_dict(dct) | |
return dct | |
def write(file_Config, cfg_Config): | |
cfg = cfg_Config | |
with open(file_Config, 'w') as configfile: | |
cfg.write(configfile) | |
def main(): | |
return spawn | |
if __name__ == '__main__': | |
main = main() | |
main('test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[BOOT] | |
BIOS: UEFI | |
[STORAGE] | |
TYPE_01 : NVME | |
TYPE_02 : FILE | |
ID_01 : /dev/nvme0n1 | |
ID_02 : /var/.8BiB-gentoo.swp | |
[STORE_PART01] | |
part : p1 | |
size : 1 | |
fs : vfat | |
LABEL={ | |
'ROOT': 'GENTOO', | |
'ESP' : 'ESP', | |
'DATA':'USERDATA', | |
'HOME': '{DATA}/@home', | |
'USER': '{HOME}/@hoefkens' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DEFAULT] | |
lblROOT : GENTOO | |
lblBOOT : ESP | |
[STORL] | |
PATH : /dev/disk/by-label | |
root : ${PATH}/${lblROOT} | |
boot : ${PATH}/${lblBOOT} | |
[STORF] | |
swap: | |
proc : /proc | |
sys : /sys | |
dev : /dev | |
[MNT] | |
PATH : /mnt | |
root : ${PATH}/${lblROOT} | |
boot : ${PATH}/${lblROOT}/boot | |
proc : ${PATH}/${lblROOT}/proc | |
sys : ${PATH}/${lblROOT}/sys | |
dev : ${PATH}/${lblROOT}/dev | |
[MNT_FS] | |
f2fs : -o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs | |
vfat : -o rw -t vfat | |
proc : --types proc | |
sys : --rbind | |
dev : --rbind | |
shm : -t tmpfs -o nosuid,nodev,noexec | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses, time | |
def input_char(message): | |
try: | |
win = curses.initscr() | |
win.addstr(0, 0, message) | |
while True: | |
ch = win.getch() | |
if ch in range(32, 127): | |
break | |
time.sleep(0.05) | |
finally: | |
curses.endwin() | |
return chr(ch) | |
def ask(Q, OPTS): | |
c = input_char('Do you want to continue? y/[n]') | |
if c.lower() in ['y', 'yes']: | |
print('yes') | |
else: | |
print('no (got {})'.format(c)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bash | |
# euses -ivcp |list availeble useflags for package | |
# equery u |list availeble useflags for package | |
#$ euse -E |add useflag to list\ package | |
# euse -p kde-plasma/plasma-meta -E discover colord grub qrcode thunderbolt | |
def USE(): | |
pass | |
def use(): | |
pass | |
def main(): | |
pass | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nano /etc/security/passwdqc.conf #--->set enforce=none | |
passwd toor | |
rc-service sshd start | |
ifconfig | |
#screen -t prep | |
# formatting | |
dd if=/dev/zero of=/dev/{disk} bs=100M status=progress | |
# | |
parted -a optimal /dev/{disk} mklabel gpt | |
cgdisk /dev/${disk} | |
parted -a optimal /dev/nvme0n1 set 1 boot on | |
mkfs.fat -F 32 -n ESP /dev/{disk}p1 | |
mkfs.f2fs -f -l GENTOO -O extra_attr,inode_checksum,sb_checksum /dev/${disk}p2 | |
mkfs.btrfs -L USERDATA -n 32k /dev/nvme0n1p4 | |
mount -o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/disk/by-label/GENTOO /mnt/gentoo | |
mkdir /mnt/gentoo/boot | |
mkdir /mnt/gentoo/var | |
mount -t vfat /dev/disk/by-label/ESP /mnt/gentoo/boot/ | |
dd status=progress if=/dev/zero bs=4096 of=/mnt/gentoo/var/.8GiB.bin bs=4096 count=2097152 | |
chmod 600 /mnt/gentoo/var/.8GiB.bin | |
mkswap /mnt/gentoo/var/.8GiB.bin | |
swapon /mnt/gentoo/var/.8GiB.bin | |
cd /mnt/gentoo | |
wget -c http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/releases/amd64/autobuilds/current-stage3-amd64-systemd/stage3-amd64-systemd-20210214T214503Z.tar.xz | |
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner | |
# | |
#make backup of etc folder to /backup/etc | |
mkdir /mnt/gentoo/mnt/backup/ | |
cp -R /mnt/gentoo/etc/ /mnt/gentoo/mnt/backup/ | |
#hier goes CFLAGS AND CXXFLAGS | |
## Compiler flags to set for all languages | |
#COMMON_FLAGS="-march=native -O2 -pipe" | |
## Use the same settings for both variables | |
#CFLAGS="${COMMON_FLAGS}" | |
#CXXFLAGS="${COMMON_FLAGS}" | |
nano -w /mnt/gentoo/etc/portage/make.conf | |
mkdir --parents /mnt/gentoo/etc/portage/repos.conf | |
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf | |
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/ | |
mount --types proc /proc /mnt/gentoo/proc | |
mount --rbind /sys /mnt/gentoo/sys | |
mount --make-rslave /mnt/gentoo/sys | |
mount --rbind /dev /mnt/gentoo/dev | |
mount --make-rslave /mnt/gentoo/dev | |
chroot /mnt/gentoo /bin/bash | |
#################################################### | |
source /etc/profile | |
export PS1="(chroot) ${PS1}" | |
emerge-webrsync | |
#emerge --sync | |
eselect profile list | |
eselect profile set 9 | |
emerge --oneshot sys-apps/portage | |
echo 'Europe/Brussels > /etc/timezone' | |
emerge --config sys-libs/timezone-data | |
echo 'en_US ISO-8859-1 >> /etc/locale.gen' | |
echo 'en_US.UTF-8 UTF-8 >> /etc/locale.gen' | |
echo 'nl_BE ISO-8859-1 >> /etc/locale.gen' | |
echo 'nl_BE.UTF-8 UTF-8 >> /etc/locale.gen' | |
locale-gen | |
eselect locale list | |
eselect locale set 10 | |
env-update && source /etc/profile && export PS1="(chroot) $PS1" | |
mkdir -p /etc/portage/package.{accept_keywords,license,mask,unmask,use} | |
########################################################### | |
echo 'ACCEPT_LICENSE="*" >> ${MAKE}' | |
echo 'ACCEPT_KEYWORDS="amd64 ~amd64" >> ${MAKE}' | |
echo 'CHOST="x86_64-pc-linux-gnu" >> ${MAKE}' | |
echo 'GENTOO_MIRRORS="${GENTOO_MIRRORS} http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ https://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ ftp://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ rsync://ftp.belnet.be/gentoo/gentoo/" >> ${MAKE}' | |
echo 'GENTOO_MIRRORS="${GENTOO_MIRRORS} http://gentoo.mirror.root.lu/ https://gentoo.mirror.root.lu/ ftp://mirror.root.lu/gentoo/" >> ${MAKE}' | |
echo 'GENTOO_MIRRORS="${GENTOO_MIRRORS} http://ftp.snt.utwente.nl/pub/os/linux/gentoo https://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo rsync://ftp.snt.utwente.nl/gentoo/" >> ${MAKE}' | |
echo 'GENTOO_MIRRORS="${GENTOO_MIRRORS} http://mirror.leaseweb.com/gentoo/ https://mirror.leaseweb.com/gentoo/ ftp://mirror.leaseweb.com/gentoo/ rsync://mirror.leaseweb.com/gentoo/" >> ${MAKE}' | |
echo 'PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/amd64-stable/" >> ${MAKE}' | |
echo 'CCACHE_DIR="/var/cache/ccache" >> ${MAKE}' | |
echo 'CCACHE_SIZE="32G" >> ${MAKE}' | |
echo 'DISTCC_DIR="/var/tmp/portage/.distcc" >> ${MAKE}' | |
echo 'FEATURES=""' | |
echo 'MAKEOPTS="" ' | |
echo 'EMERGE_DEFAULT_OPTS=""' | |
echo 'L10N="en"' | |
echo 'CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3 f16c pclmul"' | |
echo 'CONFIG_PROTECT="protect-owned"' | |
echo 'ALSA_CARDS="emu10k1 emu10k1x hdsp hdspm ice1712 mixart rme32 rme96 sb16 sbawe sscape usb-usx2y vx222"' | |
echo 'VIDEO_CARDS="nvidia intel i965 i915 v4l"' | |
echo 'INPUT_DEVICES="evdev libinput"' | |
echo 'INPUT_DRIVERS="evdev"' | |
echo 'COMMON_FLAGS="" >> ${MAKE}' | |
echo 'RUBY_TARGETS="ruby30"' | |
echo 'PYTHON_TARGETS="python3_9 python3_8 python3_7 pypy3"' | |
echo 'GRUB_PLATFORMS="efi-64"' | |
gcc -march=skylake -E -v - </dev/null 2>&1 | sed -n 's/.* -v - //p' |tee /root/etc/portage/make.conf/CFLAGS | |
emerge flaggie dev-vcs/git app-eselect/eselect-repository esearch gentoolkit | |
flaggie +64bit +bindist +wayland +wifi +static-libs +samba +quicktime +pulseaudio +offensive +networkmanager +modules +lz4 +lzo +lzma | |
flaggie +libressl +gles2 +jack +vulkan +handbook +git +custom-cflags +glxnvidia +nvidia +f2fs +btrfs +cuda +drm +d3d9 +nvcontrol | |
flaggie +nvenc +kms +ntfs +screen +shaders +evdfev +packagekit +pci +p2p +overlays +realtime +kwin | |
flaggie dev-db/sqlite-3.34.0 -icu | |
flaggie dev-lang/python-3.9.2 -bluetooth | |
mkdir -p /etc/portage/repos.conf | |
mkdir -p /etc/portage/package.use | |
eselect repository enable wayland-desktop | |
emaint sync --repo wayland-desktop | |
emerge --backtrack=250 -avD --update --newuse @world | |
echo '"sys-firmware/intel-microcode initramfs" > /etc/portage/package.use/intel-microcode' | |
emerge sys-kernel/gentoo-sources sys-kernel/linux-firmware sys-kernel/genkernel sys-firmware/intel-microcode | |
emerge pci-utils | |
nano /etc/portage/make.conf | |
cd /usr/src/linux/ | |
make menuconfig | |
make && make_modules | |
make install | |
genkernel --install --kernel-config=/usr/src/linux/.config initramfs | |
emerge sys-boot/grub eys-boot/refind | |
grub-install --target=x86_64-efi --efi-directory=/boot | |
cp /etc/default/grub /etc/backup/grub | |
emerge --ask sys-kernel/linux-firmware | |
emerge nvidia-firmware | |
emerge nvidia-drivers | |
emerge nvidia-video-codec | |
emerge egl-wayland wayland pico-wayfire qtgreet | |
emerge --ask @module-rebuild | |
grub-install --target=x86_64-efi --efi-directory=/boot | |
mkdir -p /etc/backup/default/ | |
cp /etc/default/grub /etc/backup/default/grub | |
nano /etc/default/grub | |
GRUB_CMDLINE_LINUX="init=/lib/systemd/systemd root=UUID= nvidia.modprobe=1 net.rename=0 quiet splash" | |
grub-mkconfig -o /boot/grub/grub.cfg | |
nano /etc/security/passwdqc.conf | |
passwd | |
etc-update | |
refind-install | |
USE="" | |
flaggie +{} | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#2b replaced with the correct code to put enforce=none | |
#set enforce=none | |
cmd[1]: 'nano {CFG_PWQC}' | |
passwd toor | |
rc-service sshd start | |
screen -t prep | |
# formatting | |
dd if=/dev/zero of=/dev/${disk} bs=100M status=progress | |
# | |
parted -a optimal /dev/${disk} mklabel gpt | |
cgdisk /dev/${disk} | |
parted -a optimal /dev/nvme0n1 set 1 boot on | |
mkfs.fat -F 32 -n ESP /dev/${disk}p1 | |
mkfs.f2fs -f -l GENTOO -O extra_attr,inode_checksum,sb_checksum /dev/${disk}p2 | |
mount -o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/disk/by-label/GENTOO /mnt/gentoo | |
mkdir /mnt/gentoo/boot | |
mkdir /mnt/gentoo/var | |
mount -t vfat /dev/disk/by-label/ESP /mnt/gentoo/boot/ | |
dd status=progress if=/dev/zero bs=4096 of=/mnt/gentoo/var/.8GiB.bin bs=4096 count=2097152 | |
chmod 600 /mnt/gentoo/var/.8GiB.bin | |
mkswap /mnt/gentoo/var/.8GiB.bin | |
swapon /mnt/gentoo/var/.8GiB.bin | |
cd /mnt/gentoo | |
wget -c http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/releases/amd64/autobuilds/current-stage3-amd64-systemd/stage3-amd64-systemd-20210214T214503Z.tar.xz | |
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner | |
mkdir --parents /mnt/gentoo/etc/portage/repos.conf | |
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf | |
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/ | |
mount --types proc /proc /mnt/gentoo/proc | |
mount --rbind /sys /mnt/gentoo/sys | |
mount --make-rslave /mnt/gentoo/sys | |
mount --rbind /dev /mnt/gentoo/dev | |
mount --make-rslave /mnt/gentoo/dev | |
chroot /mnt/gentoo /bin/bash | |
#################################################### | |
source /etc/profile | |
export PS1="(chroot) ${PS1}" | |
emerge-webrsync | |
emerge --sync | |
eselect profile list | |
eselect profile set 9 | |
emerge --oneshot sys-apps/portage | |
echo Europe/Brussels > /etc/timezone | |
emerge --config sys-libs/timezone-data | |
echo en_US ISO-8859-1 >> /etc/locale.gen | |
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen | |
echo nl_BE ISO-8859-1 >> /etc/locale.gen | |
echo nl_BE.UTF-8 UTF-8 >> /etc/locale.gen | |
locale-gen | |
eselect locale list | |
eselect locale set 10 | |
env-update && source /etc/profile && export PS1="(chroot) $PS1" | |
mkdir -p /etc/portage/package.{accept_keywords,license,mask,unmask,use} | |
########################################################### | |
echo ACCEPT_LICENSE="*" >> ${MAKE} | |
echo ACCEPT_KEYWORDS="amd64 ~amd64" >> ${MAKE} | |
echo GENTOO_MIRRORS="${GENTOO_MIRRORS} http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ https://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ ftp://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ rsync://ftp.belnet.be/gentoo/gentoo/" >> ${MAKE} | |
echo GENTOO_MIRRORS="${GENTOO_MIRRORS} http://gentoo.mirror.root.lu/ https://gentoo.mirror.root.lu/ ftp://mirror.root.lu/gentoo/" >> ${MAKE} | |
echo GENTOO_MIRRORS="${GENTOO_MIRRORS} http://ftp.snt.utwente.nl/pub/os/linux/gentoo https://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo rsync://ftp.snt.utwente.nl/gentoo/" >> ${MAKE} | |
echo GENTOO_MIRRORS="${GENTOO_MIRRORS} http://mirror.leaseweb.com/gentoo/ https://mirror.leaseweb.com/gentoo/ ftp://mirror.leaseweb.com/gentoo/ rsync://mirror.leaseweb.com/gentoo/" >> ${MAKE} | |
echo PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/amd64-stable/" >> ${MAKE} | |
echo CCACHE_DIR="/var/cache/ccache" >> ${MAKE} | |
echo CCACHE_SIZE="32G" >> ${MAKE} | |
echo DISTCC_DIR="/var/tmp/portage/.distcc" >> ${MAKE} | |
echo CHOST="x86_64-pc-linux-gnu" >> ${MAKE} | |
echo COMMON_FLAGS="" >> ${MAKE} | |
gcc -march=skylake -E -v - </dev/null 2>&1 | sed -n 's/.* -v - //p' >> ${MAKE} | |
nano /etc/portage/make.conf | |
ALSA_CARDS="emu10k1 emu10k1x hdsp hdspm ice1712 mixart rme32 rme96 sb16 sbawe sscape usb-usx2y vx222" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample Python script. | |
# Press Shift+F10 to execute it or replace it with your code. | |
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. | |
/boot F2FS | |
/ F2FS | |
/home BTRFS | |
swapfile | |
] | |
DISK='nvme0n1 | |
BOOT='@boot' | |
WINX f2fs 256GB | |
BTRFS \ | |
@ unused | |
@HOME /home | |
@HOEFKENS /home/hoefkens | |
@STUDIO | |
@VM | |
HOME='@/' | |
ROOT=/ | |
#BASH\ | |
sudo su - | |
passwd | |
passwd sabayonuser | |
screen -t gentoocfg | |
service ssh start | |
cgdisk /dev/nvme0n1 | |
ESP /BOOT/efi | |
BOOT /BOOT | |
GENTOO | |
USER | |
SWAP | |
def main(): | |
pass | |
# Press the green button in the gutter to run the script. | |
if __name__ == '__main__': | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
NOTFOUND = 404 | |
def r(f_props,cfg=configparser.ConfigParser()): | |
def add_header(props_file): | |
yield '[{}]\n'.format('#') | |
for line in props_file: | |
yield line | |
with open(f_props) as file: | |
file = file.readlines() | |
cfg.read_file(add_header(file), source=f_props) | |
return cfg['#'] | |
def w(f_props, props, cfg=configparser.ConfigParser()): | |
cfg['#'] = props | |
with open(f_props, 'w') as configfile: | |
cfg.write(configfile) | |
with open(f_props, 'r') as fin: | |
data = fin.read().splitlines(True) | |
for idx, line in enumerate(data): | |
data[idx] = f'{"".join(line.split())}\n' | |
data[0] = '\n' | |
with open(f_props, 'w') as fout: | |
fout.writelines(data) | |
def st(file, dct): | |
props = r(file) | |
props[list(dct.keys())[0]] = dct[list(dct.keys())[0]] | |
w(file, props) | |
def gt(file,prop, ): | |
props = r(file) | |
try: | |
dct_ret = {prop : props[prop]} | |
except: | |
return NOTFOUND | |
return dct_ret | |
def main(): | |
pass | |
if __name__ == '__main__': | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from bash import mount,make_rslave,ask,supersu,umount | |
from configparser import ConfigParser, ExtendedInterpolation | |
from pynput import keyboard | |
import cfg | |
def get_cfg(env_chroot): | |
return cfg.todct(cfg.read(f'chroot_{env_chroot.upper()}.ini', ConfigParser(interpolation=ExtendedInterpolation(), delimiters=':'))) | |
dct_chrt = get_cfg('gentoo') # returns a multilevel dict constructed from iniu file [(key) : (val][key) : (val)] | |
MNT_FS = dct_chrt['MNT_FS'] | |
STORL = dct_chrt['STORL'] | |
STORF = dct_chrt['STORF'] | |
MNT = dct_chrt['MNT'] | |
def main(): | |
dct_chrt = get_cfg('gentoo') #returns a multilevel dict constructed from iniu file [(key) : (val][key) : (val)] | |
MNT_FS = dct_chrt['MNT_FS'] | |
STORL = dct_chrt['STORL'] | |
STORF = dct_chrt['STORF'] | |
MNT = dct_chrt['MNT'] | |
#mount(STORL['boot'],MNT['boot'],MNT_FS['vfat']) # mount('/dev/disk/by-label/ESP','/mnt/gentoo/boot/', MNT_FS['vfat']) | |
#mount(STORF['proc'],MNT['proc'],MNT_FS['proc']) # mount('/proc','/mnt/gentoo/proc', MNT_FS['proc']) | |
mount(STORF['sys'],MNT['sys'],MNT_FS['sys']) # mount('/sys','/mnt/gentoo/sys',MNT_FS['sys']) | |
mount(STORF['dev'],MNT['dev'],MNT_FS['dev']) # mount('/dev','/mnt/gentoo/dev',MNT_FS['dev']) | |
make_rslave(MNT['sys']) # slave('/mnt/gentoo/sys') | |
make_rslave(MNT['dev']) # slave('/mnt/gentoo/dev') | |
if __name__ == '__main__': | |
ROOT= STORL['root'], MNT['root'].lower(), MNT_FS['f2fs'] | |
supersu('QUICK CHROOT') | |
def umount_all(): | |
umount(*ROOT) | |
try : umount_all() | |
except: pass | |
#mount(STORL['root'],MNT['root'].lower(),MNT_FS['f2fs']) | |
main() | |
# bash.run('cp' , '--dereference /etc/resolv.conf /mnt/gentoo/etc/') | |
# bash.run('test' , '-L /dev/shm ') | |
# bash.run('rm' , '/dev/shm') | |
# bash.run('mkdir', '/dev/shm') | |
# mount('shm','/dev/shm',MNT_FS['shm']) | |
# bash.run('chmod', '1777 /dev/shm') | |
# | |
# | |
# print('Press s or n to continue:') | |
# | |
# with keyboard.Events() as events: | |
# # Block for as much as possible | |
# event = events.get(1e6) | |
# if event.key == keyboard.KeyCode.from_char('s'): | |
# print("YES") | |
# | |
# | |
# | |
# | |
# | |
#bash.run('chroot','/mnt/gentoo /bin/bash') | |
#bash.run('source','/etc/profile') | |
#bash.run('export', 'PS1="(chroot) ${PS1}"') | |
#bash.run('mount', '-o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/disk/by-label/GENTOO /mnt/gentoo') | |
#bash.run('mount', '-t vfat /dev/disk/by-label/ESP /mnt/gentoo/boot/') | |
#bash.run('mount', '--types proc /proc /mnt/gentoo/proc') | |
#bash.run('mount', '--rbind /sys /mnt/gentoo/sys') | |
#bash.run('mount', '--make-rslave /mnt/gentoo/sys') | |
#bash.run('mount', '--rbind /dev /mnt/gentoo/dev') | |
#bash.run('mount', '--make-rslave /mnt/gentoo/dev') | |
#bash.run('mount', '-t tmpfs -o nosuid,nodev,noexec shm /dev/shm') | |
# livecd /mnt/gentoo # mount -t proc /proc /mnt/gentoo/proc | |
# livecd /mnt/gentoo # mount --rbind /sys /mnt/gentoo/sys | |
# livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/sys | |
# livecd /mnt/gentoo # mount --rbind /dev /mnt/gentoo/dev | |
# livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/dev | |
# livecd /mnt/gentoo # test -L /dev/shm && rm /dev/shm && mkdir /dev/shm | |
# livecd /mnt/gentoo # mount -t tmpfs -o nosuid,nodev,noexec shm /dev/shm | |
# livecd /mnt/gentoo # chmod 1777 /dev/shm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bash | |
bash.run('mount', '-o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/nvme0n1p5 /mnt/MANJARO') | |
bash.run('mount', '-t vfat /dev/disk/by-label/ESP /mnt/MANJARO/boot/') | |
bash.run('cp' , '--dereference /etc/resolv.conf /mnt/MANJARO/etc/') | |
bash.run('mount', '--types proc /proc /mnt/MANJARO/proc') | |
bash.run('mount', '--rbind /sys /mnt/MANJARO/sys') | |
bash.run('mount', '--make-rslave /mnt/MANJARO/sys') | |
bash.run('mount', '--rbind /dev /mnt/MANJARO/dev') | |
bash.run('mount', '--make-rslave /mnt/MANJARO/dev') | |
bash.run('test' , '-L /dev/shm ') | |
bash.run('rm' , '/dev/shm') | |
bash.run('mkdir', '/dev/shm') | |
bash.run('mount', '-t tmpfs -o nosuid,nodev,noexec shm /dev/shm') | |
bash.run('chmod', '1777 /dev/shm') | |
# livecd /mnt/gentoo # mount -t proc /proc /mnt/gentoo/proc | |
# livecd /mnt/gentoo # mount --rbind /sys /mnt/gentoo/sys | |
# livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/sys | |
# livecd /mnt/gentoo # mount --rbind /dev /mnt/gentoo/dev | |
# livecd /mnt/gentoo # mount --make-rslave /mnt/gentoo/dev | |
# livecd /mnt/gentoo # test -L /dev/shm && rm /dev/shm && mkdir /dev/shm | |
# livecd /mnt/gentoo # mount -t tmpfs -o nosuid,nodev,noexec shm /dev/shm | |
# livecd /mnt/gentoo # chmod 1777 /dev/shm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import prop | |
import bash | |
cGiB = 262144 | |
PW = {''} | |
PW['ROOT']= 'toor' | |
CFG={ | |
'PASSWDQC' : '/etc/security/passwdqc.conf', | |
} | |
STOR={ | |
'DEV' : '/nvme0n1', | |
'ROOT' : 'p4', | |
'BOOT' : 'p1', | |
'HOME' : 'p6', | |
'FSWAP' : '/mnt/gentoo/var/.32GiB.bin' | |
} | |
LABEL= { | |
'ROOT':'GENTOO' | |
} | |
def prepare(): | |
prop.set(CFG['PASSWDQC'],{'enforce':'none'}) | |
bash.run('passwd', f'{PW["ROOT"]}') | |
bash.run('rc-service', f'sshd start') | |
# # formatting | |
# dd if=/dev/zero of=/dev/{disk} bs=100M status=progress | |
# # | |
# parted -a optimal /dev/{disk} mklabel gpt | |
# cgdisk /dev/${disk} | |
# | |
# parted -a optimal /dev/nvme0n1 set 1 boot on | |
# | |
# mkfs.fat -F 32 -n ESP /dev/{disk}p1 | |
# | |
def wipe(file=f'/dev/{STOR["DEV"]}'): | |
bash.run('dd', f'if=/dev/zero of={file} bs=100M status=progress') | |
def fsformat(): | |
bash.run('mkfs.f2fs', f'-f -l {LABEL["ROOT"]} -O extra_attr,inode_checksum,sb_checksum /dev/{CFG["STOR"]["ROOT"]}') | |
# bash.run('mount' '-o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/disk/by-label/GENTOO /mnt/gentoo') | |
def mount(): | |
bash.run('sudo', '-S mount -o rw,acl,active_logs=6,background_gc=on,user_xattr -t f2fs /dev/disk/by-label/GENTOO /mnt/gentoo') | |
#mkfs.btrfs -L USERDATA -n 32k /dev/nvme0n1p4) | |
bash.run('mkdir', '/mnt/gentoo/boot') | |
bash.run('mkdir', '/mnt/gentoo/var') | |
bash.run('mount', '-t vfat /dev/disk/by-label/ESP /mnt/gentoo/boot/') | |
#bash.run('dd', f'status=progress if=/dev/zero bs=4096 of=/mnt/gentoo/var/.32GiB.bin bs=4096 count={32 * cGiB}') | |
bash.run('chmod','600 /mnt/gentoo/var/.32GiB.swp') | |
bash.run('mkswap','/mnt/gentoo/var/.32GiB.swp') | |
#cwd here and tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner | |
def main(): | |
mount() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#some short hands for system/user specific choises and specs | |
import configparser | |
import threading | |
import subprocess | |
import sys | |
import shlex | |
from time import sleep | |
from multiprocessing import Process | |
import prop | |
import setup_config | |
#USER VARS CHANGE THESE ACCORDINGLY | |
#DEFAULT SYSTEM VARS FOR GENTOO LIVE ISO | |
#CFG_PASSWDQC='/etc/security/passwdqc.conf' | |
CFG={'PASSWDQC':'test.conf'} | |
MAKE='/dev/portage/make.conf' | |
def cli_out(data): | |
sys.stdout.write('r{txt}'.format(txt = data)) | |
def cli_in(var): | |
userinput = input("Q for quit :") | |
def bash(cmd,args=''): | |
bashline= [cmd] + shlex.split(args) | |
process = subprocess.Popen(bashline, stdout=subprocess.PIPE, universal_newlines=True) | |
while True: | |
output = process.stdout.readline() | |
print(output.strip()) | |
# Do something else | |
return_code = process.poll() | |
if return_code is not None: | |
print('RETURN CODE', return_code) | |
# Process has finished, read rest of the output | |
for output in process.stdout.readlines(): | |
print(output.strip()) | |
break | |
return return_code | |
#print('done') | |
#subprocess.run(cmd,shlex.split(args)) | |
#print(shlex.split("gimp --no-interface -b '(python-fu-scale RUN-NONINTERACTIVE 0 0 \"img.jpg\")' -b '(gimp-quit 0)'")) | |
def main(): | |
prop.set(CFG['PASSWDQC'],{'enforce':'none'}) | |
bash('rc-service','sshd start') | |
bash('ifconfig') | |
# formatting | |
bash('dd', f'if=/dev/zero of=/dev/{disk} bs=100M status=progress') | |
# | |
#with open(CFG_PASSWDQC, rW) as script: | |
# stmts=script.readlines() | |
#for stmt in stmts: | |
# print(f'{stmt}') | |
if __name__ == '__main__': | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#some short hands for system/user specific choises and specs | |
import configparser | |
import prop | |
#USER VARS CHANGE THESE ACCORDINGLY | |
DISK="nvme0n1" | |
DISKPART="p" | |
LABEL={ | |
'ROOT': 'GENTOO', | |
'ESP' : 'ESP', | |
'DATA':'USERDATA', | |
'HOME': '{DATA}/@home', | |
'USER': '{HOME}/@hoefkens' | |
} | |
#DEFAULT SYSTEM VARS FOR GENTOO LIVE ISO | |
#CFG_PASSWDQC='/etc/security/passwdqc.conf' | |
CFG={'PASSWDQC':'test.conf'} | |
MAKE='/dev/portage/make.conf' | |
def set_prop(file,dct): | |
cfg = configparser.ConfigParser() | |
def r_props(f_props): | |
def add_header(props_file): | |
yield '[{}]\n'.format('#') | |
for line in props_file: | |
yield line | |
with open(f_props) as file: | |
file = file.readlines() | |
cfg.read_file(add_header(file), source=f_props) | |
return cfg['#'] | |
def w_props(properties_file,props): | |
cfg['#']= props | |
with open(properties_file, 'w') as configfile: | |
cfg.write(configfile) | |
with open(properties_file, 'r') as fin: | |
data = fin.read().splitlines(True) | |
for idx,line in enumerate(data): | |
data[idx] = f'{"".join(line.split())}\n' | |
data[0]='\n' | |
with open(properties_file, 'w') as fout: | |
fout.writelines(data) | |
props = r_props(file) | |
props[list(dct.keys())[0]]=dct[list(dct.keys())[0]] | |
w_props(file, props) | |
def main(): | |
set_prop(CFG['PASSWDQC'],{'enforce':'none'}) | |
#with open(CFG_PASSWDQC, rW) as script: | |
# stmts=script.readlines() | |
#for stmt in stmts: | |
# print(f'{stmt}') | |
if __name__ == '__main__': | |
main() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LABEL={ | |
'ROOT': 'GENTOO', | |
'ESP' : 'ESP', | |
'DATA':'USERDATA', | |
'HOME': '{DATA}/@home', | |
'USER': '{HOME}/@hoefkens' | |
} | |
DISK = 'nvme0n1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=9a | |
b=89a | |
enforce=test | |
delest=isdees | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DEFAULT] | |
filename : test | |
filetype : ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bash | |
bash.run('mkswap','/mnt/gentoo/var/.32GiB.swp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment