LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File S01-changedevices of Package yast2-installation-usbfix (Project home:emendonca)

#!/bin/bash
if [ ! -f /etc/install.inf ]; then
	log "Cannot find install.inf, exiting"
	exit 1
fi

import_install_inf

UUIDDEVICE=$(grep DeviceUUID\: /etc/install.inf | cut -d\: -f2- | tr -d [:space:])

# wait for the UDEV rules to trigger
log "triggering UDEV..."
systemctl start systemd-udev-trigger.service
sleep 5

if [ ! -z ${UUIDDEVICE} ]; then
	log "Using saved device ($UUIDDEVICE)"

	for f in /etc/zypp/repos.d/*repo; do
		log "Fixing repo: $f"
		sed -i "s@device=.*\$@device=/dev/disk/by-uuid/${UUIDDEVICE}@g" $f
	done

	log "repos are now using $UUIDDEVICE"
	log "Fixing device in install.inf"

	sed -i "s@device=.*@device=/dev/disk/by-uuid/${UUIDDEVICE}@g" /etc/install.inf
	sed -i "s@Device:.*@Device: /dev/disk/by-uuid/${UUIDDEVICE}@g" /etc/install.inf
else 
	log "Using device: $Device"

fi

# re-import the modified install.inf
import_install_inf