daeuniverse / dae-installer

dae's install script, written in bash.
54 stars 11 forks source link

dae-installer: user can override $MACHINE variable #20

Closed st0nie closed 4 months ago

st0nie commented 4 months ago

For some CPUs, the MACHINE variable recognized by the script may cause the downloaded dae binary not to run properly, we can avoid this by enabling the user to specify this variable.

Example:

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 18
model           : 1
model name      : AMD A6-3420M APU with Radeon(tm) HD Graphics
stepping        : 0
microcode       : 0x3000027
cpu MHz         : 800.000
cache size      : 1024 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor cx16 popcnt lahf_lm cmp_legacy extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save pausefilter
bugs            : fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2
bogomips        : 2994.60
TLB size        : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate cpb

If you run the script directly, the MACHINE variable will be recognized as x86_64-v2 but actually the CPU doesn't support v2, so the downloaded dae won't run properly.

sudo MACHINE="x86_64" sh -c "$(wget -qO- https://github.com/daeuniverse/dae-installer/raw/main/installer.sh)" @ install

Now we can override MACHINE variable to force the script to download corrected binary

st0nie commented 4 months ago

It might be more accurate to replace the current detection scheme with /lib64/ld-linux-x86-64.so.2 --help, but there is no guarantee that this so exists in the same directory on all systems, and it's more straightforward to give the user an OVERRIDE method